0
0
Wordpressframework~20 mins

Default API endpoints in Wordpress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
WordPress REST API Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2: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?
AAn HTML page showing the latest posts in a blog format.
BA plain text list of post titles separated by commas.
CA JSON object with only the total number of posts and no post details.
DA JSON array of post objects, each containing details like title, content, author, and date.
Attempts:
2 left
💡 Hint
Think about what a REST API usually returns when you ask for posts.
📝 Syntax
intermediate
1: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?
A/wp-json/wp/v2/categories
B/wp-json/wp/v2/category-list
C/wp-json/wp/v2/taxonomies/categories
D/wp-json/wp/v2/posts/categories
Attempts:
2 left
💡 Hint
Categories are a taxonomy in WordPress and have their own endpoint under wp/v2.
🔧 Debug
advanced
2: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?
AYou must use POST method instead of GET to access users.
BThe users endpoint does not exist in the default WordPress REST API.
CThe users endpoint requires authentication and you did not provide valid credentials.
DThe site has disabled the REST API completely.
Attempts:
2 left
💡 Hint
Think about what kind of data users endpoint returns and who can see it.
state_output
advanced
2: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?
AA URL-friendly version of the tag name, usually lowercase and with hyphens instead of spaces.
BThe unique numeric ID of the tag in the database.
CThe full description text of the tag.
DThe date when the tag was created.
Attempts:
2 left
💡 Hint
Slugs are often used in URLs to identify items cleanly.
🧠 Conceptual
expert
2: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?
ASend a POST request to /wp-json/wp/v2/posts/{id}
BSend a PATCH request to /wp-json/wp/v2/posts/{id}
CSend a GET request to /wp-json/wp/v2/posts/{id} with updated content in the body
DSend a PUT request to /wp-json/wp/v2/posts/{id}
Attempts:
2 left
💡 Hint
Updating part of a resource usually uses PATCH method in REST APIs.