How to return the converted image to Base64 in Postman

Asked

Viewed 763 times

4

I have a Web Service REST Server, need to traffic a web service image to the client, when the client requests a particular image, the web service does the conversion to base64 and send it to the client.

Wanted to know how I do to test the return of this image on Postman.

Does anyone have any idea how to do?

  • What is the point of the question? You asked, "Does anyone use Postman for tests?". If you want opinions about Postman, here is not the ideal place for it. But be more specific.

  • If you see the tags and the title, you should already understand the meaning of the question, I explained what I did and then asked if anyone has tested the return of the converted Base64 image in Postman, have you tested it?... or just came to criticize my question. Hugs.

  • Not my dear, just wanted to help you improve your question and at the same time help the forum. See this link about what not to ask.

  • I set the question, I hope I was specific, sorry anything.

  • 2

    Well, as far as I know, Postman only presents Pretty format for XML and JSON. To view I believe you will have to use an external app. What you can do is pass a parameter to the request when you want to test so that the return is Base64 within a tag img: <img src=”data:<MIMETYPE>;base64,<código>”>. This way you can see the image in the preview that the browsers present in the network tab. Remembering that Post also has a preview.

Show 1 more comment

1 answer

4


Only with pure code Base64 I believe you will not succeed.

What you can do is pass a parameter in the request, when you want to test, indicating that you want to put the Base64 code inside a tag img. And have a return as in the example below:

<img src="data:image/png;base64,iVBORw......" />

This way it is possible to visualize in Postman:

inserir a descrição da imagem aqui

  • 1

    I’ve been taking a look at the Postman documentation, you have to specify in Contentype = 'image/png', which would be the return. But I have to mount the tag to view the image then. Thanks for the help Felix.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.