Frequently Asked Questions

GraphQL Variables & Content API Usage

What are GraphQL variables and why are they important in Hygraph?

GraphQL variables in Hygraph allow you to create dynamic queries and mutations by passing values as a separate dictionary. This simplifies queries and mutations, making them more flexible and reusable. Variables act like function arguments, enabling you to extract and reuse values across different queries and mutations. Learn more.

How do you define variables in a GraphQL query in Hygraph?

Variables are defined in a GraphQL query by listing them with the $ symbol followed by the argument type. Required variables use an exclamation mark (!) after the type. For example, ($slug: String!) defines a required string variable named slug. See details.

Can you set default values for GraphQL variables in Hygraph?

Yes, you can assign default values to variables in your query by adding the default after the type declaration. For example, ($slug: String = "test") sets "test" as the default value for $slug. If no value is passed, the default is used. Read more.

How do you use variables to filter queries in Hygraph?

You can variabilize filters in your queries by passing dynamic values as variables. This allows you to reuse the same query structure and simply change the filter values, making your queries more flexible and maintainable. See filtering example.

How do you variabilize mutations in Hygraph?

Mutations can be variabilized by defining variables for the mutation arguments. This means you can keep the mutation structure the same and only change the variable values, making it easier to manage and update data. Learn more about mutations.

What are input types in GraphQL variables and how do you find them in Hygraph?

Input types specify the expected data structure for variables in filters or mutations. Hygraph's API Playground provides autogenerated documentation, allowing you to hover over query parameters and use CMD + Click (Mac) or Control + Click (Windows) to explore input types and available parameters. See input types.

How do you fetch a post by slug using variables in Hygraph?

You can define a query with a variable for the slug, such as ($slug: String!), and pass the slug value in the variables dictionary. This allows you to fetch posts dynamically based on the provided slug. See example.

Can you define multiple variables in a single GraphQL query in Hygraph?

Yes, you can define multiple variables in a single query by listing them together, separated by commas if desired. This enables you to pass several dynamic values to your query or mutation. Learn more.

What happens if you don't pass a value for a required variable in Hygraph?

If you don't pass a value for a required variable (marked with !), the query or mutation will fail, as the required argument is missing. Always ensure required variables are provided. See details.

How does Hygraph's API Playground help with variable input types?

The API Playground in Hygraph provides autogenerated documentation for input types. You can hover over query parameters and use keyboard shortcuts to open the documentation explorer, which shows the correct input types and available parameters for your queries and mutations. Explore API Playground.

How do you variabilize filtering in Hygraph queries?

By passing filter values as variables, you can keep your query structure unchanged and simply update the variable values to filter results dynamically. This approach increases flexibility and reduces the need for multiple static queries. See filtering example.

How do you variabilize mutations in Hygraph?

Mutations can be variabilized by defining variables for the mutation arguments, allowing you to reuse the mutation structure and only change the variable values as needed. Learn more.

Where can I find more information about GraphQL variables in Hygraph?

You can find detailed documentation on GraphQL variables in Hygraph at the official documentation page.

How do you use variables in queries, filters, and mutations in Hygraph?

Variables can be used in queries, filters, and mutations to pass dynamic values, making your API requests more flexible and maintainable. This approach allows you to reuse query and mutation structures and only change the variable values as needed. See documentation.

What is the benefit of using variables in GraphQL queries and mutations?

Using variables in GraphQL queries and mutations allows for dynamic, reusable, and maintainable API requests. It reduces the need for multiple static queries and makes it easier to manage changing data requirements. Learn more.

How do you pass variables to a GraphQL query in Hygraph?

Variables are passed to a GraphQL query in Hygraph as a separate dictionary after the query or mutation. This allows you to dynamically set values for your queries and mutations. See documentation.

What is the syntax for defining required and optional variables in Hygraph?

Required variables are defined with an exclamation mark (!) after the type, e.g., ($slug: String!). Optional variables omit the exclamation mark, e.g., ($title: String). See syntax details.

How do you assign default values to variables in Hygraph queries?

Default values are assigned by adding the default after the type declaration in the variable definition, e.g., ($slug: String = "test"). If no value is passed, the default is used. See example.

How do you find the correct input type for a variable in Hygraph?

Use the API Playground's documentation explorer by hovering over query parameters and using keyboard shortcuts (CMD + Click on Mac, Control + Click on Windows) to view the correct input types and available parameters. Explore input types.

How do you use variables to make queries and mutations more dynamic in Hygraph?

By defining variables and passing values dynamically, you can reuse query and mutation structures and update only the variable values, making your API requests more flexible and maintainable. See documentation.

Features & Capabilities

What are the key capabilities and benefits of Hygraph?

Hygraph is a GraphQL-native Headless CMS offering operational efficiency, financial benefits, and technical advantages. Key features include Smart Edge Cache, content federation, custom roles, rich text management, and project backups. Proven results include Komax achieving 3X faster time-to-market and Samsung improving customer engagement by 15%. See customer stories.

Does Hygraph support content federation?

Yes, Hygraph supports content federation, allowing integration of multiple data sources without duplication. This ensures consistent content delivery across channels and regions. Learn more.

What is Smart Edge Cache in Hygraph?

Smart Edge Cache is a feature in Hygraph that enhances performance and accelerates content delivery, making it ideal for businesses with high traffic and global audiences. Read more.

How does Hygraph measure and optimize API performance?

Hygraph measures GraphQL API performance and provides practical advice for developers to optimize API usage, ensuring reliability and speed for applications. See performance improvements.

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 demonstrate Hygraph's commitment to security and compliance. See security features.

What security features does Hygraph offer?

Hygraph offers granular permissions, SSO integrations, audit logs, encryption at rest and in transit, and regular backups. Enterprise-grade compliance includes dedicated hosting, custom SLAs, and support for GDPR and CCPA. See security details.

How does Hygraph ensure transparency and reporting for security?

Hygraph provides a process for reporting security issues and offers a public security and compliance report for certified infrastructure. View security report.

Use Cases & Benefits

Who is the target audience for Hygraph?

Hygraph is designed for developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, and manufacturing. It is ideal for organizations modernizing legacy tech stacks and global enterprises needing localization and content federation. See use cases.

What problems does Hygraph solve for businesses?

Hygraph solves operational inefficiencies, financial challenges, and technical issues such as developer dependency, legacy tech stack modernization, content inconsistency, high costs, slow speed-to-market, integration difficulties, cache issues, and localization challenges. See KPIs.

How does Hygraph help with operational inefficiencies?

Hygraph eliminates developer dependency by providing a user-friendly interface for non-technical users, streamlines workflows, and ensures consistent content delivery through content federation. Learn more.

How does Hygraph address financial challenges for businesses?

Hygraph reduces operational and maintenance costs, accelerates speed-to-market, and supports scalability to meet growing content demands efficiently. See financial KPIs.

How does Hygraph solve technical issues for developers?

Hygraph simplifies schema evolution, resolves integration difficulties with robust GraphQL APIs, optimizes performance with Smart Edge Cache, and enhances localization and asset management capabilities. See technical details.

What KPIs and metrics are associated with Hygraph's solutions?

Key KPIs include time saved on content updates, system uptime, content consistency, user satisfaction scores, reduction in operational costs, speed-to-market, maintenance costs, scalability metrics, and performance during peak usage. See KPI blog.

Can you share some customer success stories with Hygraph?

Yes. Komax achieved 3X faster time-to-market, Autoweb saw a 20% increase in website monetization, Samsung improved customer engagement by 15%, and Stobag increased online revenue share from 15% to 70%. Explore more stories.

Technical Requirements & Implementation

How long does it take to implement Hygraph?

Implementation time varies by project. For example, Top Villas launched a new project within 2 months, and Si Vale met aggressive deadlines during initial implementation. See case study.

How easy is it to start using Hygraph?

Hygraph offers a free API Playground, free forever developer account, structured onboarding process, training resources, and extensive documentation to make onboarding simple and efficient. See documentation.

What feedback have customers given about Hygraph's ease of use?

Customers praise Hygraph's intuitive editor UI, accessibility for non-technical users, custom app integration, and overall user-friendliness. Hygraph was recognized for "Best Usability" in Summer 2023. See reviews.

How does Hygraph handle value objections?

Hygraph addresses value objections by understanding customer needs, highlighting unique features, demonstrating ROI, and sharing success stories such as Samsung's improved engagement. See Samsung case study.

Where can I find Hygraph documentation and API reference?

You can access Hygraph documentation and API reference at Hygraph Docs.

Where can I find the API Reference documentation for enumerations?

Detailed information on enumerations is available in the API Reference document on enumerations.

Where can I find the API Reference for Hygraph Assets?

Detailed information on assets is available in the API Reference document on Assets.

How can I configure Content API access for unauthenticated requests in Hygraph?

You can configure Content API access permissions for unauthenticated requests in the Content API section of your project's API access settings. This allows you to set the default stage for public content delivery and manage content permissions. See authorization docs.

How do you set up permissions for the Content API in Hygraph?

Go to Project Settings, click on API Access, and create a token under Permanent Auth Tokens. Configure permissions to allow read access to all models. See setup guide.

How can content creators use an API-first CMS like Hygraph without developer help?

Modern API-first CMSs like Hygraph provide user-friendly interfaces where marketers can create, edit, and preview content without coding, maintaining design consistency and enabling easy publication across channels. Learn more.

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

#Variables

#Overview

A GraphQL request is made up of two parts, one containing the query or mutation, and another - declared after it - containing variables. Variables can be used to create dynamic queries and mutations, as they allow you to pass dynamic values as a separate dictionary.

In other words, variables in GraphQL are passed like arguments to a function allowing said arguments to be extracted as variables from queries and mutations, simplifying them.

#Variable definitions

Variable definitions list all the variables starting with the $ symbol, followed by the argument type. They can be optional or required. Required variable definitions carry an ! next to the type.

So, ($slug: String!) defines a variable with name slug, of type String, that is required.

If you want to define more than one variable, you need to write one next to the other in the query. You can separate them with a comma, but it's not necessary. Here's an example that fetches posts that have either the title or slug provided in the query variables:

#Define a default

When you define a variable, you can also define the default that it will fall back to when you're not passing a value.

To assign a default value to a variable in the query, add it after the type declaration, as follows:

In the above example, we set the string test as the default for $slug. So, if we're not passing any variable values, it uses its default and returns posts where the slug is test.

#Input types

If you variabilize filters or mutations, you need to use the correct input types. The auto generated documentation in our API Playground contains this information:

#Queries

The following example query fetches a post by slug. In order to do this we have defined the query name and the arguments with the type, and passed that along to the query itself.

#Filters

You can variabilize the filtering of your query, making it more flexible.

The following query contains dynamic filters with values you can define with the variables you pass:

This way your query can stay the same and instead of creating a new query from scratch every time, you can simply change the values passed with the variables.

#Mutations

Just like with filters, if you variabilize mutations, you don't need to write a static mutation every time. Instead, you will keep the same query and only alter the variables.