Skip to content
This repository was archived by the owner on Aug 27, 2019. It is now read-only.
This repository was archived by the owner on Aug 27, 2019. It is now read-only.

Add examples of how to write endpoints with filters and other parameters etc #142

Description

@sheriffderek

As a generalist, I appreciate the agnostic approach in how the $ curl -X OPTIONS -i http://demo.wp-api.org/wp-json/wp/v2/posts examples look, but I don't see any examples of any more complex queries.

/posts?filter[posts_per_page]=20

What if I want to see 5 posts of a certain category if written by a particular author?

@BE-Webdesign pointed out that "Both those params support csv listed ID's."
/wp-json/wp/v2/posts?author=1&categories=1

I'm personally using the API with Ember js.

I'm trying to work out some serialization between the wp-api's REST style and get it into a json-api setup - but the Docs are less help than Stack Overflow when it comes to things like filters as far as references I can look at.

Any thoughts on that? Am I looking in the wrong places? I see the parameters - but no examples of them in action. Is there a general query code style that is already assumed? Is the syntax the same as general query strings? https://en.wikipedia.org/wiki/Query_string

Thanks!

Activity

  1. BE-Webdesign commented on Apr 23, 2016

    @BE-Webdesign
    Member

    I see the parameters - but no examples of them in action. Is there a general query code style that is already assumed? Is the syntax the same as general query strings?

    You can pass via query strings, body params, etc. The API is based around HTTP so any sort of data sent via HTTP can be used in the API, depending on what you are trying to accomplish.

    I agree that more examples of queries and examples using the API in general would be extremely beneficial. If anyone would like to help out please make pull requests for the docs site!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions