Frequently Asked Questions

Top-level Remote Fields & Content Federation

What are Top-level Remote Fields in Hygraph?

Top-level Remote Fields are a feature in Hygraph that allow you to fetch remote data outside the context of a regular model and send it to your frontend alongside your Hygraph data. Unlike regular Remote Fields, which are tied to a specific model, Top-level Remote Fields are added to the Query system model and can fetch data unrelated to Hygraph content, combining it in the same API call. This enables seamless content federation, eliminating the need for separate API requests for data inside and outside of Hygraph. [Source]

How do I add a Top-level Remote Field in Hygraph?

To add a Top-level Remote Field, select the Query system model in your project schema. Then, choose the REST Remote Field option, configure the display name, API ID, remote source, method (e.g., GET), return type (e.g., a custom type like ReviewMeta), input arguments (such as productId), and the path (e.g., /api/reviews/product/{{args.productId}}). Make the field required if needed, and click Add to save. This setup allows you to fetch remote data and pass it through Hygraph's API. [Source]

What are the prerequisites for using Top-level Remote Fields?

Before adding a Top-level Remote Field, you must have a Remote Source already configured in your Hygraph project. This ensures that the field can connect to and fetch data from the external API you wish to integrate. [Source]

How can I test a Top-level Remote Field in Hygraph?

You can test a Top-level Remote Field immediately after adding it, since it is not connected to a specific content model or entry. Use the API Playground to make a query (for example, fetching reviews for a product by productId) and verify the response. This helps ensure your configuration is correct before integrating it into your frontend. [Source]

Where can I find a video tutorial on Top-level Remote Fields?

You can watch an in-depth video tutorial on Top-level Remote Fields on YouTube: Combine your APIs in your CMS with Hygraph Remote Source Fields.

Features & Capabilities

What is content federation in Hygraph?

Content federation in Hygraph allows you to integrate and deliver content from multiple sources through a single API. With features like Remote Fields and Top-level Remote Fields, you can fetch and combine data from external APIs and Hygraph content, streamlining your content delivery and reducing the need for multiple API calls. [Source]

What are the key capabilities and benefits of Hygraph?

Hygraph is a GraphQL-native Headless CMS that empowers businesses to build, manage, and deliver digital experiences at scale. Key capabilities include content federation, Smart Edge Cache for performance, custom roles, rich text management, project backups, and enterprise-grade security. Benefits include operational efficiency, reduced costs, accelerated speed-to-market, and proven results such as Komax achieving 3X faster time-to-market and Samsung improving customer engagement by 15%. [Customer Stories]

Does Hygraph support integration with external APIs?

Yes, Hygraph supports integration with external APIs through Remote Fields and Top-level Remote Fields. This enables you to fetch and combine data from various sources, including REST APIs, and deliver it through a single GraphQL endpoint. [Source]

Use Cases & Benefits

Who can benefit from using Top-level Remote Fields in Hygraph?

Developers, product managers, and marketing teams who need to combine data from multiple sources (such as product reviews, inventory, or external content) can benefit from Top-level Remote Fields. This feature is especially useful for businesses aiming to deliver unified digital experiences without building complex integrations or making multiple API calls. [Source]

What problems do Top-level Remote Fields solve?

Top-level Remote Fields solve the problem of having to make separate API requests for data inside and outside of Hygraph. They enable you to fetch and deliver remote data together with Hygraph content in a single API call, simplifying integration and improving performance for your frontend applications. [Source]

Technical Requirements & Implementation

What are the steps to configure a Top-level Remote Field for product reviews?

To configure a Top-level Remote Field for product reviews:

  1. Select the Query system model in your schema.
  2. Choose the REST Remote Field option.
  3. Set the display name (e.g., Reviews), API ID, and select the remote source (e.g., HyDemoAPI).
  4. Set the method to GET and the return type to a custom type (e.g., ReviewMeta).
  5. Add input arguments (e.g., productId of type Int, required).
  6. Set the path to /api/reviews/product/{{args.productId}}.
  7. Click Add to save the field.
After saving, you can test the field in the API Playground by querying for reviews by productId. [Source]

Can I use Top-level Remote Fields with both REST and GraphQL APIs?

Top-level Remote Fields can be configured to fetch data from REST APIs. For GraphQL APIs, you would typically use Remote Fields configured for GraphQL sources. The documentation and UI guide you through selecting the appropriate remote source type. [Source]

Support & Resources

Where can I find more documentation and support for Top-level Remote Fields?

You can find detailed documentation on Top-level Remote Fields at Hygraph Docs. For additional support, Hygraph offers 24/7 support via chat, email, and phone, a community Slack channel, and extensive guides and tutorials. [Documentation] [Slack]

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (as of August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications demonstrate Hygraph's commitment to providing a secure and compliant platform for its users. [Security Features]

Performance & Reliability

How does Hygraph ensure high performance for content delivery?

Hygraph delivers high performance through features like Smart Edge Cache, high-performance endpoints, and continuous improvements to its GraphQL API. These features ensure fast and reliable content delivery, even for high-traffic and global audiences. [Performance Improvements]

Help teams manage content creation and approval in a clear and structured way
Hygraph
Docs

#4.3 Top-level Remote Fields

#Overview

This step of our Getting Started tutorial covers Top-level Remote Fields, one of our Content Federation utilities, which eliminates the need to make separate API requests for data inside & outside of Hygraph.

In the previous step of our tutorial, we talked about Remote Fields, which we can add to a specific model and only fetch data related to it. Top-level Remote Fields can fetch remote data outside the context of a regular model, which is then sent to the front end alongside your Hygraph data.

You can add Top-level Remote Fields fields to the Query system model in your project Schema, use them to fetch data that is unrelated to Hygraph and pass it through in the same API call as the data that is related to Hygraph content. Your front end will receive this data as if coming from Hygraph despite coming from diverse sources.

#Our schema

Just like Remote Fields, Top-level Remote Fields are also dependent on our project having a Remote Source already configured. We add them to the Query system model in the same way that we add a Remote Field to a regular model.

We'll use a Top-level Remote Field to fetch review data for a product in our catalog.

Complete Top-level Remote FieldComplete Top-level Remote Field

We'll select the Query system model in our schema, then click on the REST Remote Field option on the right sidebar.

We'll use the following information:

TabFieldInput
SettingsDisplay nameReviews
SettingsAPI IDCompleting the display name will autocomplete the API ID field. We'll leave this value as it is.
SettingsRemote sourceHyDemoAPI is selected by default. We'll leave this value as it is.
SettingsMethodGET is selected by default. We'll leave this value as it is.
SettingsReturn typeUse the dropdown to select ReviewMeta, which is one of the custom type definitions we configured for our remote source earlier.
SettingsInput argumentsClick + Add to reveal more fields, which you'll complete next.
SettingsInput typeUse the dropdown to select Int.
SettingsAPI IDProductId
SettingsMake field requiredSelect this checkbox
SettingsPathWite /api/reviews/product/{{args.productId}} here.
This path will be added to our remote source base path to get a resulting endpoint.

We'll click Add to save.

#Would you like to know more?

Here's an in-depth video tutorial on Top-level Remote Fields:

#Testing our Top-level Remote Field

As it's not connected to a content model or a content entry, we can test our Top-level Remote Field right away to make sure it works correctly.

Let's go over to the API Playground and make a query to fetch all the existing reviews:

Here's a query that you can copy and paste it in the API Playground. We've included the response as well:

As you can see, this simple query fetches all the reviews we have available.