I am trying to build a script in .NET that will upload scanned documents from a folder to a given place in OTCS using the REST API. I have OTCS 2014-09.
The place is a Templated Workspace with a category attached that has required attributes, so documents uploaded there need to have attribute values or OTCS will refuse to add the documents.
I have attempted to upload the document to a different folder and then attach the category, but it fails at that point as well (probably because the required attributes don't have values at that point).
There was a thread that seemed to provide a solution where you use Content-type: multipart/form-data and your body is like the following:
-------------------------------28947758029299
Content-Disposition: form-data; name="body"
{ "type" : 144, "parent_id" : 55032739, "name" : "test", "roles" : { "categories" : { "68128" : { "68128_4" : "CLIENT_ID", "68128_5" : "UNIQUE_CLIENT_ID", "68128_12" : "Update/Inquiry", "68128_14" : "returned mail", "68128_17" : "Hackett, Jennifer", "68128_22" : 15092015 } } } }
-------------------------------28947758029299
Content-Disposition: form-data; name="file"; filename="SMALL01059001_15092015_Update@Inquiry_returned mail_62619_15092015_Oksana.Jacyla@peelregion.ca.pdf"
Content-Type: application/octet-stream
--file content goes here--
However this gives me a "Bad Request" response.
- Am I at the correct patch level for something like this to work?
- If I am, then what am I doing wrong?
Many thanks for any help on this.