im new in mobile app development ...

Can you please assist, im trying to get wordpress post on my android app but it happens only to post categories and failing to load the actual posts

Following the source code given on the link below: https://github.com/gmonetix/Gmonetix

public static final String url = "http://mysite.co.za/wp-json/wp/v2/posts/?filter[category_name]=4&per_page=50&fields=id,date,link,title,better_featured_image";

public static final String get_categories_url = "http://mysite.co.za/wp-json/wp/v2/categories?fields=id,description,name";

public static final String get_all_posts_of_category_url = "http://mysite.co.za/wp-json/wp/v2/posts?categories=CATEGORY_ID&fields=id,date,link,title,better_featured_image";

public static final String get_content_by_id = "http://mysite.co.za/wp-json/wp/v2/posts/POST_ID?fields=content";

public static final String pages = "http://mysite.co.za/wp-json/wp/v2/pages/PAGE_ID?fields=content";

Please see the below error im getting:

{"code":"rest_invalid_param","message":"Invalid parameter(s): categories","data":{"status":400,"params":{"categories":"categories[0] is not of type integer."}}}                                                   
  • fields and filter are not valid arguments for the REST API endpoints. You should review the documentation. – Jacob Peattie Aug 6 '19 at 10:26
  • "categories=CATEGORY_ID" - are you actually using the string CATEGORY_ID? I'd guess you were supposed to replace this with an integer – Rup Aug 6 '19 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.