Feedback - Lesson: Interacting with the WP REST API
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- wordpress
- Domain
- documentation
Research direction
Start with the “Interacting with the WordPress REST API” lesson linked in the issue and reproduce the endpoint request with permalinks set to Plain. Update the lesson to explain the ?rest_route=/wp/v2/books alternative alongside the pretty URL, then verify that the documented request returns the books endpoint successfully in the described local setup.
Written by the indexing model from the issue text.
Description
Type of feedback
//content
Description
I was going through this lesson: Interacting with the WordPress REST API and I was confused by the URL used for the API endpoints in the example, which is https://learn.test/wp-json/wp/v2/books. I knew that the base URL should be my localhost when running a local dev environment, but simply replacing https://learn.test with http://localhost:8888 didn't work, it only got me a 404. Only after reading Routes and Endpoints in the documentation, I found out that I needed to replace wp-json with ?rest_route= since permalinks were set to plain by default in the WP install. I think it would be helpful to mention this in the lesson, and not just refer to 'the URL to your local books endpoint', since many learners may start the lesson with the plugin files from the repository and not have the permalinks configured to enable such routes as in the example.
Step-by-step reproduction instructions (optional)
- Download version 1.0.1 of the Bookstore plugin.
- Extract the files in a new working directory.
- Run
wp-env startin that directory to create a WP install with the plugin included and run the development site atlocalhost:8888. - Open Postman and create a new GET request to
http://localhost:8888/to verify that Postman can reach the site. - Add route
wp-json/wp/v2/booksto the base url and see that the endpoint is not found. - Open the dashboard at
http://localhost:8888in your browser and navigate to 'Settings' -> 'Permalinks' and check that Permalink structure is set to 'Plain'. - Replace
wp-jsonin the Postman GET request URL with?rest_route=so that the resulting URL ishttp://localhost:8888/?rest_route=/wp/v2/books, and send the request to see that it returns a200 OK.
- Dominant language
- PHP
- Stars
- 333
- Forks
- 127
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 11
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WordPress/Learn
-
Feedback - Error in video and content in lesson "Dimensions: Padding, margin and block spacing" Open[Content] Feedback Awaiting Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
[Content] Needs Translation Reviewer [Content] Translation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Content] Needs Translation Reviewer [Content] Translation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
[Content] Needs Translation Reviewer [Content] Translation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
[Content] Needs Translation Reviewer [Content] Translation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·