What is a REST API and why is it important for modern web development?
A REST API (Representational State Transfer API) is an architectural style for building scalable and maintainable web services. It enables different systems and applications to communicate efficiently, making it a foundational technology for modern web development. REST APIs are stateless, support caching, and provide a uniform interface for clients such as web, mobile, and desktop apps. (Source)
What are the key principles of REST architecture?
The key principles of REST architecture include statelessness (no session data stored on the server), caching (improving performance and latency), and a uniform interface (consistent interaction regardless of client type). These principles ensure scalability and maintainability of web services. (Source)
Which HTTP methods are commonly used in RESTful APIs?
RESTful APIs commonly use the following HTTP methods: GET (retrieve resources), POST (create resources), PUT (update resources), PATCH (partially update resources), and DELETE (remove resources). Each method serves a specific purpose in manipulating web resources. (Source)
What data formats are supported by RESTful APIs?
RESTful APIs primarily support JSON (JavaScript Object Notation) and XML (Extensible Markup Language) for exchanging information between client and server. JSON is preferred for its lightweight and easy-to-parse nature. (Source)
How can I integrate multiple REST APIs in my application?
You can integrate multiple REST APIs by connecting various external systems to access a wider range of data and functionality. Hygraph simplifies this process with its remote sources feature, allowing you to map and query external REST APIs directly within your content model. (Source)
What is Hygraph's remote sources feature and how does it work?
Hygraph's remote sources feature enables you to integrate and query external REST APIs within your content schema. You can configure remote sources, map fields using SDL, and seamlessly query external data through the Hygraph API playground. (Source)
Can I use Hygraph to combine data from GraphQL and REST APIs?
Yes, Hygraph allows you to combine data from both GraphQL and REST APIs. For example, you can fetch user details from Hygraph via GraphQL and then use those details to query external REST APIs for additional information, such as weather or company data. (Source)
What are some practical examples of integrating REST APIs with Hygraph?
Examples include fetching user details from Hygraph and then retrieving weather data from OpenWeatherMap, or mapping external company and address details from JSONPlaceHolder into your Hygraph user model using remote sources. (Source)
How does integrating multiple REST APIs improve process efficiency and user experience?
Integrating multiple REST APIs streamlines workflows by automating data retrieval and reducing manual entry. It enables applications to offer a broader range of services, such as real-time package tracking or travel planning, enhancing both efficiency and user experience. (Source)
What are the cost benefits of integrating REST APIs instead of building features in-house?
Integrating REST APIs saves significant costs by leveraging existing vendor solutions, reducing development and maintenance expenses. Businesses can quickly access advanced features and expertise without investing in building and maintaining their own systems. (Source)
How do I map external REST API fields to my Hygraph schema?
You can convert the JSON object from the external API to SDL (Schema Definition Language) using tools like JSON2SDL, then add the custom type definition in Hygraph's remote source configuration. This allows seamless mapping and querying of external fields. (Source)
Can I query external REST API data directly from the Hygraph API playground?
Yes, once you configure a remote source and map its fields, you can query external REST API data directly from the Hygraph API playground, making it easy to test and integrate external data. (Source)
What are some common use cases for integrating REST APIs in business applications?
Common use cases include payment processing, shipping management, logistics tracking, travel planning, and enriching user profiles with external company or address data. These integrations help businesses offer comprehensive services efficiently. (Source)
How do I handle errors when integrating external REST APIs?
When integrating external REST APIs, handle errors by using try-catch blocks in your code, returning appropriate error messages to the client, and logging errors for debugging. Hygraph's documentation provides examples for robust error handling. (Source)
Where can I find more technical documentation on integrating REST APIs with Hygraph?
How does Hygraph support both REST and GraphQL APIs?
Hygraph supports both REST and GraphQL APIs, allowing you to integrate external REST APIs via remote sources and leverage its native GraphQL architecture for querying and managing content. This flexibility enables seamless data federation and integration. (Source)
What steps are involved in configuring a remote source in Hygraph?
To configure a remote source in Hygraph: 1) Go to Schema → Remote Sources → Add, 2) Enter display name and select API type (REST), 3) Enter the base URL, 4) Map fields using SDL, 5) Save and use the remote source in your content model. (Source)
Can I use Hygraph to enrich user profiles with external company and address data?
Yes, you can use Hygraph's remote sources feature to enrich user profiles by querying external REST APIs for company and address details, then mapping those fields into your user model. (Source)
How do I query a specific user's external data using Hygraph?
In Hygraph, you can configure a REST field in your user model, select the remote source, and use a dynamic path (e.g., /{{doc.userId}}) to query external data for a specific user. This enables personalized data enrichment. (Source)
Where can I find more examples and guides for integrating APIs with Hygraph?
For more examples and guides, visit the Hygraph blog and the Hygraph Documentation portal, which provide step-by-step tutorials and best practices. (Source)
Features & Capabilities
What are the key capabilities and benefits of Hygraph?
Hygraph offers a GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, asset management, cost efficiency, and accelerated speed-to-market. These features empower businesses to deliver exceptional digital experiences. (Source)
Does Hygraph support integration with other platforms and tools?
Yes, Hygraph provides integrations with Digital Asset Management (DAM) systems like Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot, and other platforms such as Adminix and Plasmic. Custom integrations are also possible via SDKs and APIs. (Source)
What APIs does Hygraph offer?
Hygraph offers multiple APIs: Content API (read/write), High Performance Content API (low latency, high throughput), MCP Server API (AI assistant integration), Asset Upload API, and Management API. Each API serves specific use cases for content management and integration. (Source)
How does Hygraph ensure high performance for content delivery?
Hygraph delivers high performance through optimized endpoints designed for low latency and high read-throughput. It actively measures API performance and provides best practices for optimization, as detailed in the performance blog and GraphQL Report 2024.
What technical documentation is available for Hygraph?
Hygraph provides extensive technical documentation covering API reference, schema components, references, webhooks, AI integrations, and more. Access all resources at Hygraph Documentation.
How easy is it to set up and use Hygraph?
Hygraph is noted for its intuitive user interface and ease of setup. Non-technical users can start using it immediately, and features like custom app integration and real-time changes make content management straightforward. (Source)
What feedback have customers given about Hygraph's ease of use?
Customers praise Hygraph for its intuitive editor UI, ease of setup, and ability to manage content independently. Real-time changes and custom app integration enhance the user experience. Some users note that complex projects may require more technical expertise. (Source)
How long does it take to implement Hygraph?
Implementation time varies by project complexity. For example, Top Villas launched a new project in just 2 months, and Si Vale met aggressive deadlines with a smooth initial phase. Hygraph offers structured onboarding and training resources for quick adoption. (Source)
What support resources are available for Hygraph users?
Hygraph provides webinars, live streams, how-to videos, extensive documentation, and a community Slack channel for support and guidance. (Source)
Pricing & Plans
What pricing plans does Hygraph offer?
Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and limits tailored to individual, small business, and enterprise needs. (Source)
What features are included in the Hobby plan?
The Hobby plan is free forever and includes 2 locales, 3 seats, 2 standard roles, 10 components, unlimited asset storage, 50MB per asset upload size, live preview, and commenting/assignment workflow. (Source)
What features are included in the Growth plan?
The Growth plan starts at $199/month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload size, remote source connection, 14-day version retention, and email support desk. (Source)
What features are included in the Enterprise plan?
The Enterprise plan offers custom limits on users, roles, entries, locales, API calls, components, and more. It includes scheduled publishing, dedicated infrastructure, global CDN, 24/7 monitoring, security controls, SSO, multitenancy, backup recovery, custom workflows, dedicated support, and custom SLAs. (Source)
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure high standards for data protection and information security. (Source)
How does Hygraph ensure data security?
Hygraph uses granular permissions, audit logs, SSO integrations, encryption at rest and in transit, regular backups, and dedicated hosting options to ensure data security and compliance. (Source)
Use Cases & Benefits
Who can benefit from using Hygraph?
Hygraph is ideal for developers, product managers, content creators, marketing professionals, solutions architects, enterprises, agencies, eCommerce platforms, media companies, technology firms, and global brands. (Source)
What industries are represented in Hygraph's case studies?
Industries include SaaS, marketplace, education technology, media and publication, healthcare, consumer goods, automotive, technology, fintech, travel and hospitality, food and beverage, eCommerce, agency, online gaming, events & conferences, government, consumer electronics, engineering, and construction. (Source)
What business impact can customers expect from using Hygraph?
Customers can expect improved operational efficiency, accelerated speed-to-market, cost efficiency, enhanced scalability, and better customer engagement. Case studies show tangible results, such as Komax achieving 3X faster time-to-market and Samsung increasing engagement by 15%. (Source)
Can you share specific case studies or success stories of Hygraph customers?
Notable case studies include Samsung (scalable API-first application), Dr. Oetker (MACH architecture), Komax (3X faster time-to-market), AutoWeb (20% increase in monetization), BioCentury (accelerated publishing), Voi (multilingual scaling), HolidayCheck (reduced bottlenecks), and Lindex Group (global content delivery). (Source)
Who are some of Hygraph's customers?
Hygraph's customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi, representing a diverse range of industries and use cases. (Source)
What pain points do Hygraph customers commonly express?
Customers often face developer dependency, legacy tech stack challenges, content inconsistency, workflow inefficiencies, high operational costs, slow speed-to-market, scalability issues, complex schema evolution, integration difficulties, performance bottlenecks, and localization/asset management challenges. (Source)
How does Hygraph differentiate itself in solving these pain points?
Hygraph differentiates itself with a user-friendly interface, GraphQL-native architecture, content federation, cost efficiency, accelerated speed-to-market, robust GraphQL APIs, Smart Edge Cache, and enhanced localization/asset management. These features set it apart from traditional CMS platforms. (Source)
Why should a customer choose Hygraph over alternatives?
Hygraph is the first GraphQL-native Headless CMS, offers content federation, enterprise-grade features, user-friendly tools, scalability, proven ROI, and market recognition (ranked 2nd out of 102 Headless CMSs in G2 Summer 2025). These strengths make it a compelling choice for modern businesses. (Source)
Learn how to effectively integrate multiple REST APIs, as well as how to do it in Hygraph with the help of remote sources.
Last updated by Aagam
on Dec 23, 2024
Originally written by Hygraph
REST, or Representational State Transfer, is an architectural style for building web services. Rest APIs are a flexible and efficient way for different systems and applications to communicate with each other and are widely used in modern web development. In this article we will learn about the concept of REST APIs, their importance, and how to effectively implement them into your own systems and applications.
Rest APIs are based on the REST architecture, which is a set of principles for building scalable and maintainable web services. The key principles of REST are
Statelessness - Systems that follow Rest APIs are stateless, which means that the server and client are decoupled. There is no session data that the server needs to maintain for the client. Every client request will contain all the necessary information for the server to identify the client and process the request.
Caching - Rest APIs can leverage caching, basically storing frequently accessed data temporarily in memory or for backend applications in a data store like redis. This improves performance and latency of the API. Every response should contain if it can be cached and if yes then for how long.
Uniform Interface - This principle suggests that there should be a uniform way to interact with the server irrespective of what type of client (web apps, mobile apps, desktop apps) wants to communicate with the server.
REST methods
RESTful APIs use a set of standard methods to access and manipulate web resources. The most commonly used methods are
GET: Retrieving an existing resource. For Example:
GET /users to fetch a list of all users.
GET /users/121 to retrieve details of the user with ID 121.
POST: Creating a new resource.
POST /users with a JSON payload like {"name":"John Doe", "email" : "john@hygraph.com"} creates a new user.
PUT: Update an existing resource.
PUT /users/121 with a JSON payload like { "name": "Jane Doe", "email": "jane@example.com" } replaces all details of the user with ID 121 -
PATCH: Partially update an existing resource.
PATCH /users/123 with a payload like { "email": "newemail@example.com" } updates only the email of the user with ID 123.
DELETE: Delete a resource.
DELETE /users/123 removes the user with ID 123.
REST protocols
RESTful APIs use HTTP (Hypertext Transfer Protocol) as the communication protocol. HTTP is the same protocol that is used by the World Wide Web and it is a standard protocol for transmitting data over the internet.
Data formats
RESTful APIs support different data formats for exchanging information between client and server. They mainly include JSON (JavaScript Object Notation) and XML (Extensible Markup Language). JSON is the preferred format used while building REST APIs today as it is lightweight and easy to parse. XML has become less popular in recent decades.
Endpoints
RESTful APIs have a set of endpoints that are used to access and manipulate various resources. Endpoints are URLs that define the location of a resource on the server. Each endpoint corresponds to a specific resource and uses different methods to access the resource.
For example
GET /orders - API endpoint to get a list of orders
POST /users - API endpoint to create a new user
Example
Here is an example of how you can use the axios library in a Next.js application to make a GET request to Github’s REST API.
The axios.get() function is used to send a GET request to the public API exposed by Github The params object allows us to add query parameters (q, sort, and per_page in this example)
Overall in this code, we are searching for the repositories related to next.js, sorting by stars and limiting the number of results to 10. If the request is successful, if the promise is resolved, the response data is logged to the console. If there is an error, the promise is rejected and the error is logged to the console.
This is a very simple example of how to make a GET request to an external REST API in Next.js, we can similarly make POST, PUT, and DELETE requests and customize it by adding query parameters, headers, or request bodies depending on what the API endpoint supports.
Integrating external APIs is becoming common for businesses. Connecting various systems saves a lot of time and effort for businesses and also provides a user experience for the customers.
Accessing wide range of data and functionality
One of the main reasons for integrating multiple REST APIs is to access a wider range of data and functionality. A software system can have many moving components, and there are two options when it comes to building new features: do we want to build it from scratch or use something that is a one-stop solution for that feature? It totally depends on the scale, and finances of the company, If it is a big company operating on a massive scale, building the product in-house might benefit them, whereas for smaller companies it might be cost effective to leverage and integrate existing APIs from some vendor.
For example - A small retail business can be more efficient and benefit by integrating
A payment vendor and it’s APIs to process transactions
A shipping vendor and it’s APIs to manage shipping and delivery
Building entire payment and shipping systems might be very unreasonable for small scale retail businesses..
Improving process efficiency & user experience
Another reason for integrating multiple REST APIs is to improve the efficiency of any part of your system. You might not be able to cover all use cases when building things in house, but some vendor who has been in that field for years might have everything you need to scale up your business from zero to one.
For example, a logistics company may need to integrate with multiple external APIs to track packages, calculate shipping rates, and check delivery status. This eliminates the need for manual data entry and improves the accuracy of the package information.
Integrating multiple REST APIs can also help to enhance the user experience. For example, a travel application may integrate with multiple flight, hotel, and car rental APIs to provide a one-stop shop for customers to plan their trips. By integrating these different vendors, the application can offer a wider range of services for the user very quickly.
Cost benefits
It can also help save enormous costs, integrating multiple REST APIs can save a significant amount of money for businesses compared to building the functionality in-house. By using pre-existing APIs, businesses can take advantage of the development and maintenance that has already been done, rather than having to invest in building and maintaining their own systems. Additionally, the costs associated with integration, such as testing and development, are typically lower than those associated with building from scratch.
Furthermore, building an API in-house can be a time-consuming and complex process, especially for businesses that lack the necessary technical expertise. By using existing APIs from proper vendors, businesses can get up and running quickly, without having to invest the time and resources required to build those functionalities from scratch.
In addition to cost and time savings, integrating REST APIs also allows businesses to leverage the expertise of the API provider. For example, an API provider may have more experience in a specific area or have more resources to devote to security and compliance. This can help to ensure that the integrated API is of high quality and meets the necessary standards.
We shall understand how to integrate multiple external APIs with the help of two examples
Example 1
We can have scenarios where we need to consume GraphQL APIs and Rest APIs to build a particular functionality. If you are unaware of GraphQL, please check our detailed guide to get started.
Use Case - Getting User’s Weather Details Imagine we want to display weather details on a user dashboard, here’s the scenario
User Details - Stored in Hygraph
Weather Information - Weather API is supported by OpenWeatherMap
We will write code for a Next.js API that will fetch user details by making an API call to HyGraph and then we will use the location details of the user to get the weather details from OpenWeatherMap.
First, let us write a function to get user details from Hygraph using a GraphQL API call.
console.log('getUserLocation, Something Went Wrong', err);
res.status(400).json(defaultReturnObject);
}
}
The getUserLocation function makes a GraphQL API request using the graphql-request library with a query to Hygraph requesting user details for a user. Any runtime errors that might occur have been handled in the code. Next, let's create a function to fetch weather details using the user’s location.
console.log('getUserWeatherDetails, Something Went Wrong', err);
res.status(400).json({message:'Failed to get weather details'});
}
}
getUserWeatherDetails is the main exported function where we are expecting email as a parameter in the query string of a request. We are using the getUserLocation function to fetch the user details by email from Hygraph. Then we use the user’s location to make a GET request to the OpenWeatherMap API and fetch the weather data. Any runtime errors are handled in the catch block and an appropriate message is returned to the client.
Note: Please replace OPENWEATHER_API_KEY with your own API key, this will be provided by the external service provider (i.e OpenWeatherApp in this case)
This is how we can integrate multiple APIs into our application.
Example 2
Another common use case is when we have a headless CMS and we want to query some external data. Many systems provide the capability to integrate and query external APIs and return them in a seamless way. In HyGraph, it is very easy to integrate external sources with the help of remote sources feature.
Use case: We have a user model in Hygraph that stores the basic details of the user like firstname, lastname, userId, and email. We want to query an external API to get the user’s company and address details. For demonstration purposes, we can use the free JSONPlaceHolder REST API.
Steps
In our Hygraph application, go to Schema → Remote Sources → Add
Copy this JSON object above and convert it to SDL using something like JSON2SDL, copy the output SDL. Inside our Remote source configuration in HyGraph click Add Custom Type Definition and paste the generated SDL over there. This will help Hygraph to map the fields from the REST API so that it can be seamlessly queried from the Hygraph GraphQL playground.
Hit Save
Now that we have our remote source and its mapping configured in Hygraph, we can consume it in our user model.
Steps
1. Go to the Hygraph user model, and from the right-hand side, select - REST field.
2. Select the Remote Source that we configured in the previous steps, add /{{doc.userId}} in the path field, and click submit. This is because we want to query an endpoint like https://jsonplaceholder.typicode.com/users/:id
3. Now we can go to the API playground and seamlessly query our remote field from there.
Our documentation on Remote sources has in depth explanations for all possible configurations of using remote sources with a Hygraph schema.
To conclude, in this article we learned about the fundamentals of a REST API, we discussed the importance of integrating multiple REST APIs and explored the benefits of doing so such as access to a wider range of data and functionality, improved efficiency, enhanced user experience, and cost savings compared to building the functionality in-house. Finally, we went through some examples that demonstrated how to integrate external APIs to our existing systems and using remote sources in Hygraph.
Blog Authors
Aagam Vadecha
Hygraph Team
Share with others
Sign up for our newsletter!
Be the first to know about releases and industry news and insights.