WP-API / docs-v2

Documentation for version 2 of the API
http://v2.wp-api.org
58 stars 76 forks source link

Filter (More) Fields plugin - useful? #160

Open theprojectsomething opened 8 years ago

theprojectsomething commented 8 years ago

Put together a very basic plugin last night that allows deep filtering of returned data via query vars. Uses syntax close to the Facebook Graph API for accessing inner fields, e.g. {api_endpoint}/posts?fields=id,acf{related_posts.limit(2){id}}

[{
  "id": 1,
  "acf": {
    "related_posts": [
      { "id": 2 },
      { "id": 3 }
    ]
  }
}]

Github repo is here: https://github.com/theprojectsomething/REST-API-Filter-More-Fields

Yet to publish on WP.org but it's currently working and is handy in combination with other API plugins like ACF To WP API. Keen to get some thoughts on the usefulness of the syntax before putting more effort in.