How to post image file type in postman or rest client form data?

Lokesh picture Lokesh · Nov 14, 2017 · Viewed 7.8k times · Source

I did one project in Android (Retrofit) ,I could have gotten response fine in APP,but I don't know how to get response in Postman and Advanced REST client , my issue is how do I send file Type(I don't know what to call it is),In project I achieved by putting new TypedFile("image/png",... but how would I put these parameters in Postman and Advanced REST client? I want to check and know about it, I searched lot and I tried lot but no result. Please help me...

Here is project code:

 MultipartTypedOutput multipartTypedOutput = new MultipartTypedOutput();
    try {
        multipartTypedOutput.addPart("originalImgBlob", new TypedFile("image/png", files.get(0)));
        multipartTypedOutput.addPart("img430Blog", new TypedFile("image/png;base64", files.get(1)));
        multipartTypedOutput.addPart("img200Blog", new TypedFile("image/png;base64", files.get(2)));
        multipartTypedOutput.addPart("img100Blog", new TypedFile("image/png;base64", files.get(3)));
        multipartTypedOutput.addPart("blurResponseBlob", new TypedFile("image/png;base64", files.get(4)));
        Log.d("UploadActivity", "postNewsFeed() returned: " + "" + files.get(2));
    } catch (Exception e) {
        e.printStackTrace();
    }
    doServereCall(multipartTypedOutput);

/* Set profile pic in registration */
@Headers("Accept:application/json")
@POST("/api/mbrphotos/prfImgIU/{memberId}/{actionType}")
public void sendMultiImages(@Path("memberId") String memberId,
                            @Path("actionType") String actionType,
                            @Body MultipartTypedOutput multipartTypedOutput, Callback<JsonObject> callback);

Answer

Dharmishtha picture Dharmishtha · Nov 14, 2017

You can check API response in postman by following steps :

  1. selecting post method .
  2. Then in that select body option .
  3. now select form-data option. after that you have new view that available for enter key and value .
  4. Here you can check your API . I also attach image as source for your help. And select file type in key field to post as File Type . After selecting file type Choose files Browse button is available to you to select file.enter image description here