How to send a base64 image in postman

2019-04-05 12:02发布

问题:

Need to make a request to a api with a image encoded in base64, the request is a put, and i was trying making in the body section using the raw format and adding i.e. this json:

{
 "picture": {
    "name": "/Users/Cokeina/Desktop/imagenes/default_avatar.png",
    "content_type": "image/png",
    "file": "base64string"
 }
}

but seems like this isn't working, what is the correct way to do this?

回答1:

You could find online base64 image encoder. They encode an image to a string.

The example of raw body in JSON format in the POSTMAN:

"profile": {
    "first_name": "John",
    "last_name": "Dow",
    "photo": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
}

I think, that "name" and "content_type" is obvious in your JSON.



标签: postman