CA Service Management

 View Only
  • 1.  Upload attachment SDM API REST returns BadRequest

    Posted Feb 07, 2019 06:44 PM

    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



  • 2.  Re: Upload attachment SDM API REST returns BadRequest

    Posted Feb 26, 2019 05:54 PM

    hi MNX

     

    I think that the "Content-Transfer-Encoding: binary" parameter in the multipart file is missing.



  • 3.  Re: Upload attachment SDM API REST returns BadRequest

    Posted Feb 28, 2019 01:10 PM

    Isn't this the same question as in

    https://communities.ca.com/thread/241820963-upload-attachment-sdm-api-rest-returns-badrequest 

    and so already answered ?

    Regards

    ...........Michael



  • 4.  Re: Upload attachment SDM API REST returns BadRequest

    Posted Feb 28, 2019 02:18 PM

    Hi Michael_Mueller,

     

    Yes, The question is the same, but the last answer was very generic, it refers to the use of the api rest, my answer is more specific with respect to the test that does mnx and what is missing for the requirement to work, which is to add the parameter Content-Transfer-Encoding, at least I did not need to add the characters "/ r", attached example image.