WP Tavern › Forums › Create Topic
Jason It’s great that batching for REST was added to core! It’s still not quite the same as GraphQL that allows you to batch, but also follow nested resources. Like: { posts { nodes { id title author { node { id firstName avatar { url } } } categories { nodes { id name } } } } } with REST, even with batching, you’d still need to wait for the initial response for the posts endpoint to come back, then the client would have to parse that response, figure out which IDs and endpoints are relevant, then make the follow-up batch request for authors, categories, etc, but then for the next set of nested resources, like user avatars, you’d have to make more follow-up requests and track how it all comes together in the client. Definitely a nice improvement for the core REST API to have batch requests, but it doesn’t quite solve things for client developers that GraphQL does.
Jason
It’s great that batching for REST was added to core!
It’s still not quite the same as GraphQL that allows you to batch, but also follow nested resources.
Like:
{ posts { nodes { id title author { node { id firstName avatar { url } } } categories { nodes { id name } } } } }
with REST, even with batching, you’d still need to wait for the initial response for the posts endpoint to come back, then the client would have to parse that response, figure out which IDs and endpoints are relevant, then make the follow-up batch request for authors, categories, etc, but then for the next set of nested resources, like user avatars, you’d have to make more follow-up requests and track how it all comes together in the client.
Definitely a nice improvement for the core REST API to have batch requests, but it doesn’t quite solve things for client developers that GraphQL does.
Name *
Email *
Website:
Topic Title (Maximum Length: 80):
Forum: — No forum —AI and WordPress Articles Blocks Showcase Discussions Events Introductions Jobs and Working in WordPress Podcast Episodes Site and Block Editor
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Email Address
Submit
Enter the destination URL
Or link to existing content