I couldn't find an example of how to create a document with all Its attributes, relationships and files in eB by consuming the WSG web services.
Do you have any test application example with code to work with the WSG and eB?
And one more question: all the task that can be done by consuming the old .asmx eB web service can be done by consuming the new JSON WSG web services?
Thanks a lot for your help, kind regards,Sebastian.
As mobile apps are not in the plan, I would recommend using our latest Early Adopters Preview version (02.00.04.43) that comes with 2.4 API and multiple improvements/features to eB plugin. T download the same, I would request you to please contact your account manager (Bentley) to deliver the same.
WSG 02.00.04.43 also comes with updated developer guide in HTML format that can be found in each deployment (just go to localhost/ws)
Even if deployment guide examples use PW schema, those are still valid for other plugins too:
- All requests are the same for all the plugins. The names used in URLs and JSON, like class names, property names, relationships are defined in schema(s) and can be different, but request format is identical.
- Each plugin (and actually each connection) can have multiple different schemas so you need to use meta schema urls to check what schemas, classes, properties and relationships are available in your repository (deployment guide has examples for that too). You can download whole schema in EC XML format and browse it locally if needed.
- If I understood the feature list correctly:
As I mentioned above requests are the same for any plugins, but in any case – please find few document and file creation examples below.
Document creation sample when template name was specified on deployment:
Method POST:https://[machineName]/ws/v2.4/Repositories/Bentley.eB--viltest2-51.bentley.com~2CeB16.4_wsg/eB/Document
Headers:Authorization: Basic YWRtaW46YWRtaW4=Content-Type: application/json
Request body:{"instance": { "className": "Document", "schemaName": "eB", "properties": {"Name":"DocumentName1" },
"relationshipInstances": [ { "className": "FolderDocument", "schemaName": "eB", "direction": "backward", "relatedInstance": { "instanceId": "14", "className": "Folder", "schemaName": "eB" } } ] }}
You can create a Document without specifying template Name while deploying, however you must specify Template Id property on request body.
Method POST:https:// [machineName]/ws/v2.4/Repositories/Bentley.eB--viltest2-51.bentley.com~2CeB16.4_wsg/eB/File
Headers:Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468Authorization: Basic YWRtaW46YWRtaW4=
Request body:---------------------------acebdf13572468Content-Disposition: form-data; name="fieldNameHere"Content-Type: application/json
{ "instance": { "schemaName": "eB", "className": "File", "changeState": "new", "properties": { "Name": "Test.txt", }, "relationshipInstances" : [{ "className" : "DocumentFiles", "direction" : "backward", "properties" : {}, "relatedInstance" : { "className" : "Global_Document_DOC1", "instanceId" : "15", "schemaName" : "EB_ECPLUGIN_SCHEMA", }, "schemaName" : "eB" }], }}---------------------------acebdf13572468Content-Disposition: form-data; name="fieldNameHere"; filename="Test.txt"Content-Type: text/plain
aaa---------------------------acebdf13572468—
Answer Verified By: Sebastian Fernandez Pacheco
All the versions from 15.6.1 till the latest 16.4.2. If you want to upgrade, we would recommend to go for 16.4.2.