Recall & Review
beginner
What is a REST API?
A REST API is a way for different programs to talk to each other over the internet using simple commands like GET, POST, PUT, and DELETE. It works like ordering food at a restaurant: you send a request, and you get a response.
Click to reveal answer
beginner
How do you fetch data from a WordPress REST API using JavaScript?
You use the fetch() function with the WordPress REST API URL. For example, fetch('https://example.com/wp-json/wp/v2/posts') gets the list of posts in JSON format.
Click to reveal answer
beginner
What HTTP method do you use to create a new post via the WordPress REST API?
You use the POST method to send new data to the server and create a new post.
Click to reveal answer
intermediate
Why do you need to include authentication when modifying WordPress data via REST API?
Because changing data like creating or deleting posts needs permission. Authentication proves you have the right to make those changes.
Click to reveal answer
beginner
What is the purpose of the 'wp-json' part in the WordPress REST API URL?
The 'wp-json' part tells WordPress to use its REST API system to send or receive data in JSON format.
Click to reveal answer
Which JavaScript function is commonly used to call a REST API?
✗ Incorrect
fetch() is used to make network requests, including calling REST APIs.
What HTTP method is used to update existing data in a REST API?
✗ Incorrect
PUT is used to update existing data on the server.
In WordPress REST API, what does the endpoint '/wp-json/wp/v2/posts' return?
✗ Incorrect
This endpoint returns the list of posts in WordPress.
Why is authentication important when using REST API to modify WordPress content?
✗ Incorrect
Authentication proves you have permission to make changes.
Which format does WordPress REST API use to send data?
✗ Incorrect
WordPress REST API uses JSON format for data exchange.
Explain how you would use JavaScript to get a list of posts from a WordPress site using the REST API.
Think about sending a request and reading the response.
You got /4 concepts.
Describe why authentication is necessary when creating or deleting posts via the WordPress REST API.
Consider site security and permissions.
You got /4 concepts.