Create Topic

WP Tavern Forums Create Topic

Create New 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.






Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.