-
Notifications
You must be signed in to change notification settings - Fork 194
Status Check: Add REST API endpoint #4790
Description
Feature Description
We're seeing reports from users where they create a story, and upon saving get greeted with error messages because saving failed due to the REST API not being available.
The problem is that they might not be saving for quite some time, so it's really frustrating to get error messages after an hour or so and potentially lose all your work.
What If upon loading of the editor/dashboard we perform some simple REST API request and see if the response is OK. If it isn't, then the REST API is likely not available, and we can display a warning message to the user.
We could probably just re-use -> WAF detection is only possible on client-side.\WP_Site_Health::get_test_rest_availability() for this. Alternatively we could do the same thing on the client-side.
Downside: this is another HTTP request that might be unnecessary for the majority of users.
Alternatives Considered
Better documentation that the REST API is required
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
Implementation Brief
- When loading dashboard/editor...
- Create a temporary story in PHP with
auto-draftstatus, using demo content forpost_contentfield, just so we have aWP_Postobject to work with. - Provide this story object via an inline script
- On the client side, generate the story's HTML markup using
getStoryMarkup() - Send a
POSTrequest containing this full markup to/wp-json/web-stories/v1/web-story/<id> - -> check status code, response content, etc. to see if this was successful or not
Exact checks TBD
- Create a temporary story in PHP with
Open questions:
- Create new
web-stories/v1/status-checkREST API endpoint for this? - Also send a
GETrequest?