โ06-25-2019 07:50 AM
Iโm having trouble correctly formatting multipart form-data to be sent as the body of a REST Post request along with a single file upload.
Iโve managed to get the Post request to correctly send in Postman with the required key/value pairs and a test file:
However, when attempting to replicate this in SnapLogic I am unsuccessful.
Iโve managed to correctly map the key/value pairs in a mapper, and have created the following JSON in a JSON generator using my mapped values:
Iโve used my โentityโ object as the HTTP entity in my Post request, and pointed to a local test file for upload in my REST Post snap:
Is my approach to compiling the form-data correct, or no?
โ07-01-2019 09:52 AM
Could you expand that temporary headers section in postman in the request header section? What kind of authorization are you using in both postman and SL?
Also, have you checked the endpoint to see if the file from the SL post made it there regardless of the response body itโs giving back?
โ07-02-2019 07:27 AM
Here are my temporary headers in Postman:
To my knowledge there is no way to check if the file has been committed to the server, this call is the second call in a three-part upload process through the API. I can verify this if need be.
The first API call prepares the upload, the second API (this call) uploads the file to the server, and the third API call commits the uploaded file to the endpoint using values in the response body of this second API call.
โ07-02-2019 08:35 AM
If I had to guess Iโd say it was the cookie. Postman is auto-sending this for you because it is stateful probably captured it in the return of your first API call.
In SnapLogic, each of the snaps execute separately, even if you have a chain of rest snaps they all function independently so you donโt have that luxury. Youโd probably need to send the cookie which youโd probably get back in the header of your first call, and pass it as cookie header on calls 2/3.
Without sending the cookie for the second response Iโd guess the server wouldnโt be able to tie it to the first rest op so itโs just giving you a blank response back.
โ07-02-2019 12:07 PM
I passed the cookie into the request headers from my first API call with no luck, my response body is still empty from my Post request
I sincerely appreciate the help to date - at this point Iโve reached out to an administrator who wrote the endpoint APIโs who can help clarify the formatting of the request for accuracy on their end.
โ05-20-2020 10:16 AM
Hi, Iโm looking to send a request that uses REST Post Multipart Form-Data without the file upload. Iโm having issues configuring the REST Post Snap. What should go into the HTTP Entity and how do we ensure it sends it as multipart/form-data rather than application/json.