ReST API

This API is a more robust alternative to simple RSS feeds, giving you more control over data retrieval and providing a more comprehensive set of results in JSON format.

e.g., You can list posts, search posts, sort by custom criteria, paginate, and then retrieve titles, content, images, categories, tags, and more.

Tip: The API is powered entirely by WordPress. So in addition to the examples seen below, you can also leverage these powerful WordPress features, providing you with access to additional endpoints and other named arguments.


Documented below, these are the two most popular API endpoints.

/posts

Retrieve a list of posts.

https://src.works/wp-json/wp/v2/posts

Named Arguments

page=1

Page number.

per_page=10

Max results to return per page.

search=

Search keyword or terms.

order=desc

One of asc or desc.

orderby=date

One of date, relevance, id, include, title, or slug. This allows you to sort the results as you see fit for a particular purpose.

See also: list of all supported arguments


/posts/<id>

Retrieve information about a specific numeric post /<id>

https://src.works/wp-json/wp/v2/posts/<id>

Named Arguments

There is generally no reason to pass arguments when requesting information about a specific post. Simply include a numeric Post /<id> in the URL, as seen above. That will suffice. However, WordPress does support some obscure arguments for this request type. See: list of all supported arguments.


See also: Simple RSS Feeds as an alternative.