REST API not working with MEDIA
-
Hi,
I recently started working with the GD REST API to create data from my mobile app, I noticed the images are not working properly when creating posts from the API. via the regular API psot request you can upload a featured_media, but GD seems to have also the featured_image/images which by default will be image 0 and the featured one in the cards (Archive templates).The GD API documentation is very limited, no reference at all in how to add media/images to the listings, which takes the purpose of API, since Images are one of the most important aspects of a listing.
This is the response I get when using API, which is not correct, as you can see id:0 for featured_image and image.
"featured_media": 1551, "featured_image": { "id": 0, "title": "website screenshot", "src": "https://s.wordpress.com/mshots/v1/http%3A%2F%2Fwww.austintheatre.org%2F?w=825&h=430", "thumbnail": "https://s.wordpress.com/mshots/v1/http%3A%2F%2Fwww.austintheatre.org%2F?w=825&h=430", "width": "", "height": "" }, "images": [ { "id": 0, "title": "website screenshot", "src": "https://s.wordpress.com/mshots/v1/http%3A%2F%2Fwww.austintheatre.org%2F?w=825&h=430", "thumbnail": "https://s.wordpress.com/mshots/v1/http%3A%2F%2Fwww.austintheatre.org%2F?w=825&h=430", "featured": false, "position": 0 }When I add media to GD in the POST request to create listing:
"featured_media": 1546, "featured_image": [ ], "images": [ ],How can I add the featured_image and images in the POST request in order to have images in GD archives (item) cards.
Thank you very much.
The topic ‘REST API not working with MEDIA’ is closed to new replies.