[ad_1]
I’m trying to retrieve a Reusable Block via the REST API like so:
`GET /wp-json/wp/v2/blocks/123`
Then I get this response:
>{
“code”: “rest\_forbidden”,
“message”: “Sorry, you are not allowed to do that.”,
“data”: {
“status”: 401
}
}
I can hit other endpoints like `/posts/` just fine.
Is there a good way to retrieve content within Reusable Blocks via the REST API?
[ad_2]
You’ll need to be authenticated for your requests. The `posts` endpoint is public, which is why you can access it without being authenticated.
You can read more about it here:
https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/
If you don’t need something like JWT auth for an app, just use this for auth:
https://github.com/WP-API/Basic-Auth