How can I upload an image from post-man to the loopback component storage upload api. I have already setup the api and successfully uploaded to the storage through file upload from a form from my website, but I am not able to post it from postman. What should be the request body and headers for the same?
1 Answers
3
votes
Say you have base api root http://myserver.com
To create a container :
1) The url : http://myserver.com/containers
2) Request Header : Content-Type : application/json
3) Body (you can set it in raw tab) :
{
"name": "my-container"
}
4) Method : POST
To upload a file to container my-container
1) The Url : http://myserver.com/containers/my-container/upload
2) Request Header : Content-Type : application/x-www-form-urlencoded
3) Body : form-data
(you choose the file in tab form-data
)
The
key
is not important. Even it can be empty.The
value
should be of typefile
.
When you choose value type of file, the file chooser appears and you can select the file.
4) Method : POST