EDIT: I have reported the issue to the development team of the plugin and they have resolved it in BETA10 version of the plugin.

I have been trying to fetch all the media files from the REST API using restangular, but no matter how I try it fails, so I decided to test the media endpoint via PostMan app and realized that although I can see the media files json object in my browsers when I browse to /wp-json/wp/v2/media but using PostMan or using restangular it always results in an empty array.

The funny part is that during the time I was pulling my hair for getting the media files, the files showed up only once, and after one refresh they were gone forever, this could be a bug in the wp rest plugin v2beta9.

  • It works correctly here, both from Postman and restangular. You may need to peform some debug and provide deeply information.
    – cybmeta
    Jan 7, 2016 at 11:25
  • @cybmeta I have ran all sorts of testings on it, I am not getting errors in my console or anywhere else. In fact if I use the same code, but change the route from media to /wp-json/wp/v2/users or /wp-json/wp/v2/posts I will get the objects for the users or the posts, but for /wp-json/wp/v2/media it will just gives me an empty array. Any ideas? Jan 7, 2016 at 12:31
  • It may be the basic authentication falling (I see you are using it on the screenshot), so please provide add all the information to the question, and this about Basic Authentication is important information you missed. We can not paly to "guess". Again, it works perfectly here; no issue at all.
    – cybmeta
    Jan 7, 2016 at 12:40
  • @cybmeta As I explained before, I have ran all sorts of tests on it, with or without authentication, restnagular uses wp_nonce authentication, fails to get the object with no errors, I also tried postman with basic authentication, and without any authentications at all. Both fails without any errors. I will try it on another system too (windows PC) to make sure it's not a local bug. Jan 7, 2016 at 12:48
  • 1
    Yes it's reported and they have labeled it as a bug, hopefully will be fixed in beta 10. Jan 8, 2016 at 20:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.