I am busy trying to understand how WP REST API works in combination with React. When I check the documentation of WP REST API, it confuses me a bit.
https://developer.wordpress.org/rest-api/reference/comments/#retrieve-a-comment
For example here, it seems like you have to specifically give the ID of a post in the query to fetch the post. Can we not use a variable for this? If so, how could this be done? And how could we make sure that per post, automatically we also fetch its comments beneath it?
I mean, this gets all of the comments:
https://example.com/wp-json/wp/v2/comments
But it does not let me combine this with the posts. How do we relate them with each other?
Another example:
https://example.com/wp-json/wp/v2/posts?categories=33
Would mean that we you fetch the categories of post with ID = 33, but how can we make this generic? Like https://example.com/wp-json/wp/v2/posts?categories=$GET_POST_ID
or so?
post
argument to limit comments to the specified post.