Hi David,
To attach a file to a given item, the call needed is as follows:
POST api/rest/v1/workspaces/{id}/items/{dmsID}/attachments
How to about doing this? Well, you must create the above HTTP request with type of multipart/mixed or multipart/form-data and provide the metadata and binary information into two parts within the same call.
* The first part should be declared as application/json and provide a name, unique identifier, and description to use for the file in PLM.
* The second provides the binary stream of the file being uploaded. Its content would be declared as application/octet-stream.
There is a basic cURL example here that unfortunately, doesn't cover the binary stream section.
http://help.autodesk.com/view/PLM/ENU/?guid=GUID-F31EF246-A5EA-4892-B188-AA3F11DE4DBB
Here's an example for each part in that POST multipart request payload:
// part 1
Content-Type: application/json
{
"fileName":"MyFile.jpg",
"resourceName":"ProductPhoto01",
"description":"Front cover photo for product."
}
// part 2
Content-Type: application/octet-stream
Content-Disposition: *; filename=name.ext;
{binary-number}
{binary-number}
...
You should get a response similar to this:
{
"file": {
"deleted":false,
"dmsID":297,
"versionID":0,
"workspaceID":8,
"dmsID":297,
"fileID":580,
"fileName":"MyFile.jpg",
"resourceName":"ProductPhoto01",
"description":"Front cover photo for product.",
"fileSize":108315,
"fileVersion":1,
"fileStatus": {
"statusID":1,
"status":"Checked IN",
"description":"The file is checked in and available for check out"
},
"createdUserID":"jbloggs",
"createdDisplayName":"Joe Bloggs",
"timeStamp":"2014-08-01T15:58:51.688-04:00",
"folderId":0
}
}
Hope this helps,
Martin Gasevski | Fusion 360 Team Product Manager