What's the advantage of using the datocms-client (npm) or the GraphQL API

Hi there,

I’m building a backend service that will fetch content from Dato and was wondering what the benefits are over the datocms-client (npm) vs the GraphQL API? Thanks

Hello @bismark and welcome to the community!

If you are planning to just fetch Data and not modify it then the advantages of the GraphQL API compared to the Node client are very similar to the advantages of GraphQL APIs vs REST APIs as you can read here: Content Delivery API - Overview - DatoCMS Docs

From the DatoCMS specific point of view, both APIs have different rate-limitations, the CDA (GraphQL) specifically has special rate limits for cached requests: Content Delivery API - Rate limiting - DatoCMS Docs
While the content management API has these rate limits: Rate limits - DatoCMS

As a general rule, if you are just fetching information, the CDA is generally best, as you can fetch cached requests, with fewer round-trips, and fetch only the parameters you are interested in.
If you are in need of modifying the Data, then the CMA is the way to go.

Thank you.

1 Like