I need to get all the images that are uploaded in my wordpress installation using the REST API.
I've tried using the wp-json/wp/v2/media
endpoint but it will give me only the last 10 images uploaded that are attached to the last published post but this isn't what I was expectinng.
How I can get all the images that are uploaded in wordpress unsing the rest api?
I need to get all the images that are uploaded in my wordpress installation using the REST API.
I've tried using the wp-json/wp/v2/media
endpoint but it will give me only the last 10 images uploaded that are attached to the last published post but this isn't what I was expectinng.
How I can get all the images that are uploaded in wordpress unsing the rest api?
So the problem you are encountering is that you can not request all of them at once. Meaning you have to add a parameter to the request. Something like this:
/wp-json/wp/v2/media?per_page=100
If you have more than 100 images you have to paginate through the results, using the page parameter. Something like this:
/wp-json/wp/v2/media?per_page=100&page=1
/wp-json/wp/v2/media?per_page=100&page=2
If you need any further information, let me know!
add per_page: 100 as params also set page: 1 for first 100 and 2 for next 100
Have a look:- https://i.sstatic.net/Mbd5F.png
?per_page=20
then, or another limit up to 100. But there's no reason you can't use the API more than once to build up a list in pages, either at the beginning or dynamically as they're needed. – Rup Commented Sep 23, 2020 at 16:29