0

I am working on an Android application for my Wordpress site, I've added the Rest API plugins in order to be able to get the data in JSON form.

I am using the following URL to get posts

http://mywordpress.com/wp-json/wp/v2/posts/?categories=1&per_page=100

I am using &per_page=100 because it seems that by default it loads only 10 posts. My problem is that every time I load posts in my Android app, the posts are displayed in a random order, I am using SwipeRefreshLayout so that I can refresh the posts, but each time I do the refresh the posts are displayed in random ordered, is there a way I can order my posts by date desc?

Set
  • 47,577
  • 22
  • 132
  • 150
Ali Akkawi
  • 313
  • 4
  • 13

1 Answers1

0

JSON data can never be relied upon to be in a certain order. Refer to JSON order mixed up

Sort the data to get a certain order.

Community
  • 1
  • 1
Jim Bergman
  • 5,207
  • 2
  • 17
  • 19
  • Hello Jim, thanks for your answer, actually when i try this url using Postman tool from google, it always show the same order for the posts, but the problem is when loading the posts from my Android app – Ali Akkawi Feb 11 '17 at 00:01