I just tried to do a 'checkout,' change my file contents, then a 'create an attachment' for the same file and then an 'undo checkout.' I think this process did exactly what I would expect in that the checkout was taken away but the file contents were not updated so the attached file was the same as it was before the 'checkout' was performed. Is that the same for you? I would think that I would have to successfully complete a 'checkin' for the file to be updated.
I have tried to do the 'checkin' by creating the multipart/mixed request with the json as the first part and the second part being the file binary data. I do this via curl:
curl -v -k -i -X POST \
-H "Content-Type: multipart/mixed" \
-H "Accept: application/json" -H "Cookie: customer=<customer>; JSESSIONID=<sessionid>;" \
-F "metadata=@file.json; type=application/json" \
-F "content=@'document.pdf'; type=application/octet-stream" \
https://<tenant>.autodeskplm360.net/api/rest/v1/workspaces/22/items/14305/attachments/16/checkins'
with the file.json being:
{
"fileName":"document.pdf",
"resourceName":"document.pdf",
"description":"Test Document"
}This returns a 500 - Internal Server Error:
HTTP/1.1 500 Internal Server Error
Date: Mon, 27 Jul 2015 14:04:47 GMT
Server: Apache
Set-Cookie: PLM360LBR=cookie==; path=/; domain=tenant.autodeskplm360.net
Vary: Cookie,Host,Accept-Encoding
Cache-Control: no-cache
Access-Control-Expose-Headers: X-AUTODESK-URI-ENCODING
Content-Length: 154
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-XSS-Protection: 1; mode=block
Connection: close
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><errors xmlns:ns2="http://ns.autodesk.com/storage/v1"><httpStatusCode>500</httpStatusCode></errors>
Any help is appreciated.
Thanks,
Nick