• I can do this:

    Get all posts (defaults to ‘post’ type): /wp-json.php/posts/
    Get defined post types: /wp-json.php/posts/types/
    Get single post by id (e.g. ’11’): /wp-json.php/posts/11

    I can see that the getPosts method accepts a $filters argument. How would I pass filters to the posts endpoint?

    Thanks for any information and for contributing this plugin!

    Darin

    http://wordpress.org/extend/plugins/json-rest-api/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ryan McCue

    (@rmccue)

    Apologies for not getting back to you sooner!

    $filters can be passed in as GET parameters: ?filters[x]=y

    Thanks. I didn’t find this on the docs.

    I case someone else have problems with it, filters should be passed as
    ?filter[x]=y
    filter instead of filterS.

    Thanks for this awesome plugin!

    Also, remember to pass filter[x]=y when you want to filter multiple things:

    ?filter[post_status]=draft&filter[posts_per_page]=2

    Took me some time to figure out…

    EDIT: removing my post info and made a new one, apologies for adding what I thought was a related question but not directly the same.

    “Hopefully jumping on this thread was ok since it also related to filters.

    Cheers!”

    @geet Jacobs: It is considered impolite to interrupt another poster’s ongoing thread unless you are posting a solution or suggestion. It causes significant problems for the forum’s volunteers and prevents us from being able to track issues by topic. Please post your own topic.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Passing filters’ is closed to new replies.