Challenge - 5 Problems
WordPress REST API Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What is the output of fetching the default posts endpoint?
You make a GET request to the WordPress REST API endpoint
/wp-json/wp/v2/posts. What kind of data do you receive?Attempts:
2 left
💡 Hint
Think about what a REST API usually returns when you ask for posts.
✗ Incorrect
The default posts endpoint returns a JSON array of post objects with detailed information like title, content, author, and date.
📝 Syntax
intermediate1:30remaining
Which URL correctly accesses the default categories endpoint?
You want to get the list of categories using the WordPress REST API. Which URL is correct?
Attempts:
2 left
💡 Hint
Categories are a taxonomy in WordPress and have their own endpoint under wp/v2.
✗ Incorrect
The correct endpoint for categories is /wp-json/wp/v2/categories.
🔧 Debug
advanced2:00remaining
Why does this request to /wp-json/wp/v2/users return a 401 error?
You try to fetch users with a GET request to
/wp-json/wp/v2/users but get a 401 Unauthorized error. What is the most likely reason?Attempts:
2 left
💡 Hint
Think about what kind of data users endpoint returns and who can see it.
✗ Incorrect
The users endpoint requires authentication because user data is sensitive. Without credentials, WordPress returns 401 Unauthorized.
❓ state_output
advanced2:00remaining
What is the value of the 'slug' field in the response from /wp-json/wp/v2/tags?
You fetch tags from the endpoint
/wp-json/wp/v2/tags. What does the 'slug' field represent in each tag object?Attempts:
2 left
💡 Hint
Slugs are often used in URLs to identify items cleanly.
✗ Incorrect
The slug is a URL-friendly string derived from the tag name, used in URLs and queries.
🧠 Conceptual
expert2:30remaining
Which default REST API endpoint would you use to update a post's content?
You want to update the content of a post using the WordPress REST API. Which endpoint and HTTP method combination is correct?
Attempts:
2 left
💡 Hint
Updating part of a resource usually uses PATCH method in REST APIs.
✗ Incorrect
The WordPress REST API supports updating posts with PATCH requests to /wp-json/wp/v2/posts/{id}. POST is for creating, GET is for reading, PUT is less commonly used here.