
/api/v1/media
This is the api {"title":"some title","https://picsum.photos/200/300":"","fileNamefileName":{"fileName":"good}} please help me,i need create media with image
Tagged:
/api/v1/media
This is the api {"title":"some title","https://picsum.photos/200/300":"","fileNamefileName":{"fileName":"good}} please help me,i need create media with image
Answers
There are 2 step required to add an image to media
1. Create a media id by sending post request to Media with MediaFolderId like this
www.example.com/api/v1/media?_response=true
with body
{
"mediaFolderId": "aa387d75254946bdbd27cb018e433da0"
}
you will get the response with id which will be act as mediaId.
2. Now you have to post media using this id
http://www.example.com/api/v1/_action/media/fbb9048e53d6485f9f77f28458aea98f/upload?extension=jpg&fileName=myImage
and with body
{
"url":"https://upload.wikimedia.org/wikipedia/commons/8/8b/BD_4C_Cartoon_(PSF).jpg"
}
and thats it.