- Route vs Endpoint
- HAL standard
- Global Parameters
Route vs Endpoint
Routes are like the urls that we use for accessing stuff. Example would be http://wordpress-dev.local/wp-json/
The Route when combined with a REST method becomes an endpoint
The route http://wordpress-dev.local/wp-json/wp/posts has endpoints for GET, PUT and DELETE.
We communicate with the endpoints using the appropriate methods from out REST client (insomnia in my case). We can also use curl for this.
To list all the endpoints, we can send request to http://wordpress-dev.local/wp-json/

HAL (Hypertext Application Language) Standard
In the response we get we can see the _links key, which has links to stuff our post is connected to.
the WordPress REST API does not closely follow this standard but the _links is taken from this standard.
You can check more about this at https://en.wikipedia.org/wiki/Hypertext_Application_Language
Global Parameters
I learned about these global paramters that we can set in the request
_fileds_embed_method_envelope
_fields
If we want only some fields then there is no reason to query for all of them, this parameter helps us do that.
I wrote this request and added _fields parameter so only id is returned.


_embed
We can use this parameters to get the href for embeddable links


Below the _links, you can see the _embedded. This will ony return if the links have set embeddable as true.
_envelope
This is a really cool paramter, using this we can get the headers as a response. Check this

Leave a Reply