I have an Image Uploading API which I call from android and Its working fine.Now I want to test same API using Postman.
Someone please guide me to test this API on Postman. What parameters I need to set in Postman to test this API.
I have tried to test this API using following parameters in post man but till now not able to succeed. I tried to attach image in postman parameter and converted image to binary then add that binary in postman parameter but API is giving unsuccessful response.
--16cbe71399a
Content-Disposition: form-data; name="binaryFile"; filename="ec6152a8a12b4782b1c4bcc95cc98eeb"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
binaryFile:{local path of image}
--16cbe71399a--
The working android code is as follows:
API: http://testing/api/editImage/
Header:
("Content-Type", "multipart/form-data; boundary=" + boundary);<br>
("Authorization", "bearer "+preference.getFileAPIAuthenticationToken())<br>
Body:
writer.append("--" + boundary).append(CRLF);
writer.append("Content-Disposition: form-data; name=\"binaryFile\"; filename=\"" + ugid + "\"").append(CRLF);
writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(binaryFile.getName())).append(CRLF);
writer.append("Content-Transfer-Encoding: binary").append(CRLF);
writer.append(CRLF);
// file write in binary
writer.append(CRLF);
writer.append("--" + boundary+ "--").append(CRLF);