## api – Working Around rest_forbidden_context

Question

I am trying to request page content, but the raw page content, calling this route:

"/wp-json/wp/v2/pages/" + id + "?context=edit"


In response to this I get:

code: "rest_forbidden_context"
data: {status: 401}
message: "Sorry, you are not allowed to edit this post."


Makes sense, guessing I just can’t get the edit content unathenticated.
However, it is unclear to me how I can retrieve the raw content of a post/page from the API.

Potential Solutions I am struggling to find:

1. Is there a way to auth through the api?
2. Can I define my own endpoint to get around this?
3. Can I turn off any authentication requirements (my wordpress sits headless behind a server anyways so I’m not worried about security)
0
10 months 2022-04-20T20:37:25-05:00 0 Answers 0 views 0