AnsweredAssumed Answered

Upload attachment SDM API REST returns BadRequest

Question asked by MNX on Feb 7, 2019

I'm following the the Java sample code (from SampleAttachFileToResource.java) for uploading an attachment using the SDM REST API (version 17.1), using Postman, but continue to receive the cryptic BadRequest response with no idea of what is "bad" with my request. If anyone can help me understand what I'm missing, it would be greatly appreciated.

 

Here is what I'm sending via Postman:

--*****MessageBoundary*****
Content-Disposition: form-data; name="payload"
Content-Type: application/xml; CHARACTERSET=UTF-8

<attmnt><repository id="1002"></repository><orig_file_name>test.txt</orig_file_name><attmnt_name>test.txt</attmnt_name><description>Upload using REST</description></attmnt>

--*****MessageBoundary*****
Content-Disposition: form-data; name="test.txt"; filename="test.txt"
Content-Type: application/octet-stream

7B68747470733A2F2F73646D73746167652E75776D65646963696E652E6F72673A383035312F63616973642D726573742F63723F7265706F7369746F727949643D31303032267365727665724E616D653D4956542D53444D322E414D432E55574D45444943494E452E4F5247266D696D65547970653D54657874266465736372697074696F6E3D4E6F6E6272616E64656453697465732E6373767D

--*****MessageBoundary*****--

 

Here's the header info:

POST /caisd-rest/attmnt?repositoryId=1002&serverName=ivs-sdm2&mimeType=Text&description=test.txt HTTP/1.1
Host: sdm.someserver.org:8051
X-AccessKey: 30769721
Content-Type: multipart/form-data; BOUNDARY=*****MessageBoundary*****
Cache-Control: no-cache

Outcomes