You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current mirror node REST API provides a functional API that returns most of the data users need. However, due to the
nature of REST APIs, it suffers from problems inherit in REST itself including both under-fetching and over-fetching.
Under-fetching can occur when the user does one query to fetch a list of items, then for each item in the list does
another query to get nested data. For example, if you use the REST API to query for a list of accounts and then get each
account's list of NFTs. REST APIs don't allow the user to define the nested or related data to return everything in one
response and avoid multiple round trips to the server. Similarly, REST APIs don't support standard ways of doing nested
pagination that would allow for such query patterns. If the user is going to do this N+1 call regardless we might
as well do it more efficiently on the server side.
Over-fetching can occur when all fields are returned in the REST response. The user should be able to
select which fields they care about and the API should return only those. Some REST APIs allow users to supply a
list of fields to return which works fine for top-level fields but breaks down when attempted for nested fields or
lists.
GraphQL is an API query language developed by Facebook (Meta) and now widely accepted as a popular alternative to REST.
It can help alleviate some of the above problems and the development of such an API has been requested from internal and
external members of the Hedera community.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Extracted from the draft located here: HIP-668
Motivation
The current mirror node REST API provides a functional API that returns most of the data users need. However, due to the
nature of REST APIs, it suffers from problems inherit in REST itself including both under-fetching and over-fetching.
Under-fetching can occur when the user does one query to fetch a list of items, then for each item in the list does
another query to get nested data. For example, if you use the REST API to query for a list of accounts and then get each
account's list of NFTs. REST APIs don't allow the user to define the nested or related data to return everything in one
response and avoid multiple round trips to the server. Similarly, REST APIs don't support standard ways of doing nested
pagination that would allow for such query patterns. If the user is going to do this
N+1
call regardless we mightas well do it more efficiently on the server side.
Over-fetching can occur when all fields are returned in the REST response. The user should be able to
select which fields they care about and the API should return only those. Some REST APIs allow users to supply a
list of fields to return which works fine for top-level fields but breaks down when attempted for nested fields or
lists.
GraphQL is an API query language developed by Facebook (Meta) and now widely accepted as a popular alternative to REST.
It can help alleviate some of the above problems and the development of such an API has been requested from internal and
external members of the Hedera community.
Feedback is always welcome!
Beta Was this translation helpful? Give feedback.
All reactions