How to upload or download a file using the Bentley Web Services Gateway with eB Plugin - I'm getting 500 errors.

I am trying to create a new object in eB, with a file attachment, but I'm getting stuck - can anyone help me or should I raise a support request?

The steps I'm taking are:

GET https://<host>.bentley.com//ws/v2.8/Repositories 

GET https://<host>.bentley.com/ws/v2.8/Repositories/Bentley.eB--<host>-app.bentley.com,<name>-eb-db-prod-classic/MetaSchema/ECClassDef?$filter=SchemaHasClass-backward-ECSchemaDef.Name+in+['EB_ECPLUGIN_SCHEMA']

GET https://<host>.bentley.com/ws/v2.8/Repositories/Bentley.eB--<host>-app.bentley.com,-<name>-db-prod-classic/EB_ECPLUGIN_SCHEMA/Global_Document_Type/<id>/$file

This fails with the response:

{
    "errorId": null,
    "errorMessage": "The file (1218076) either does not exist or it is in a repository not accessible from this site or is not available at this time.",
    "errorDescription": null
}


Q1.) Why does this fail? What am I doing wrong?

POST https://<host>.bentley.com/ws/v2.8/Repositories/Bentley.eB--<host>-app.bentley.com,<name>-eb-db-prod-classic/EB_ECPLUGIN_SCHEMA/Global_Document_Type

---------------------------acebdf13572468
Content-Disposition: form-data; name="My File.pdf"; fileName="My File.pdf"
Content-Type: application/pdf

<My File.pdf>

---------------------------acebdf13572468
Content-Disposition: form-data; name="instance"; fileName="blob"
Content-Type: application/json

{
  "instance": {
    "schemaName": "EB_ECPLUGIN_SCHEMA",
    "className": "Global_Document_Type",
    "properties": {
      "Code": "WSG-TEST-WITH-FILE",
      "Name": "WSG Test With File"
    }
  }
}
---------------------------acebdf13572468


This fails with the response:

{
   errorId: null,
   errorMessage: "Files cannot be added to Planned Documents.",
   errorDescription: null
}

Q2.) What does this error message mean? What am I doing wrong?

I then tried to create a new object, and upload a file in a second request.  The second request was

PUT https://<host>.bentley.com/ws/v2.8/Repositories/Bentley.eB--<host>-app.bentley.com,<name>-eb-db-prod-classic/EB_ECPLUGIN_SCHEMA/Global_Document_Type/<instanceId>/$file

This failed with a 500 server error.  POST does the same.

Q3.) Why is this causing a 500 error? What am I doing wrong?

I am unable to find any useful documentation on performing these seemingly routine steps, or any information on the errors I'm receiving, so any help you can offer would be really appreciated.

Parents Reply Children
No Data