Kaizen #149: Using GraphQL APIs to fetch data in a consolidated way

Kaizen #149: Using GraphQL APIs to fetch data in a consolidated way



Hello everyone!
Welcome to this week's post in the Kaizen Series! This week, we will discuss GraphQL APIs, a query language that provides an efficient, powerful, and flexible method for fetching and manipulating data from Zoho CRM.
Let us consider the scenario of a large industrial equipment manufacturer,  Zylker Manufacturing.  They utilize Zoho CRM to streamline their sales processes and customer relationship management. Their sales support team uses a legacy system to manage their activities. When a contact seeks support, the support team must have access to the latest data from Zoho CRM to assist them better. They need:
  • details of the contact, such as email, phone, and Account details
  • details of the ongoing deals of the contact, including potential revenue and stages .
With GraphQL APIs, with a single API call, you can create custom unified view that combine information from multiple Zoho CRM modules. This allows the support team to view all relevant information in one place, making it easier to manage sales processes and customer interactions. To create the view, metadata of the fields is also required.  This structured approach in GraphQL allows Zylker Manufacturing to efficiently aggregate data.


You need to construct a GraphQL query to fetch specific data related to a contact and associated deals, as well as metadata about the fields in the Contacts and Deals modules. Let's break down each part of the query that can achieve this.

1. Fetching Contact and Deal Information


  • Records: Records comprises the records from the different Zoho CRM modules.
  • Contacts: Specifies that we want to query the records of the Contacts module. The where clause filters the contacts based on their email address.
  • _data: This indicates the fields we want to retrieve from the records. In this case:
    • Email: Fetches the email of the contact.
    • Full_Name: Fetches the full name of the contact.
    • Deals__r: Fetches the related deal record of the Contact. 
      • Expected_Revenue: Fetches the expected revenue from each deal.
      • Deal_Name: Fetches the name of each deal.
      • Stage: Fetches the current stage of each deal.


Records {
    Contacts(where: { Email: { equals: "krismarrier@noemail.com" } }) {
        _data {
            Email {
                value}
            Full_Name {
                value}
            Deals__r {
                _data {
                    Expected_Revenue {
                        value}
                    Deal_Name {
                        value}
                    Stage {
                        value
                    }}}}}}




2. Fetching Metadata for Contacts


  • Meta: This fetches the details of the metadata for Contacts module. It uses the alias "contact_meta"
  • Modules(filter: { api_name: "Contacts" }): Specifies that we want to fetch the metadata of the Contacts module.
  • _data: This indicates the fields we want to retrieve. In this case:
    • id: The unique identifier for the module.
    • api_name: The API name for the module.
    • module_name: The name of the module.
    • description: The description of the module.
    • plural_label, singular_label: Labels used for the module.
    • fields: Retrieves metadata for specific fields within the module. filter: { api_names: ["Last_Name", "Email"] }: Specifies which fields' metadata to retrieve.For each field, it retrieves:
      • id: Field identifier.
      • api_name: API name for the field.
      • display_label: The display name of the field.
      • json_type: The data type as represented in JSON.
      • data_type: The Zoho CRM data type of the field.
 contact_meta: Meta {
    Modules(filter: { api_name: "Contacts" }) {
      _data {
        id
        api_name
        module_name
        description
        singular_label
        plural_label
        fields(filter: { api_names: ["Last_Name", "Email"] }) {
          _data {
            id
            api_name
            display_label
            json_type
            data_type
          }
        }
      }
    }
 }

3. Fetching Metadata for Deals


  • Meta: This fetches the details of the metadata for Deals module. It uses the alias "deal_meta"
  • Modules(filter: { api_name: "Deals" }): Specifies that we want to fetch the metadata of the Deals module.
  • _data: This indicates the fields we want to retrieve. In this case:
    • id: The unique identifier for the module.
    • api_name: The API name for the module.
    • module_name: The name of the module.
    • description: description of the module.
    • plural_label, singular_label: Labels used for the module.
    • fields: Retrieves metadata for specific fields within the module.
    • filter:  api_names: ["Expected_Revenue", "Deal_Name","Stage"] }: Specifies which fields' metadata to retrieve.For each field, it retrieves:
      • id: Field identifier.
      • api_name: API name for the field.
      • display_label: The display name of the field.
      • json_type: The data type as represented in JSON.
      • data_type: The Zoho CRM data type of the field.
deal_meta: Meta {
    Modules(filter: { api_name: "Deals" }) {
        _data {
            id
            api_name
            module_name
            description
            singular_label
            plural_label
            fields(filter: { api_names: ["Expected_Revenue", "Deal_Name","Stage"] }) {
                _data {
                    api_name
                    id
                    display_label
                    json_type
                    data_type
                }
            }
        }
    }
}

The complete query will look this:


query {
  Records {
    Contacts(where: { Email: { equals: "krismarrier@noemail.com" } }) {
      _data {
        Email {
          value
        }
        Full_Name {
          value
        }
        Deals__r {
          _data {
            Expected_Revenue {
              value
            }
            Deal_Name {
              value
            }
            Stage {
              value
            }
          }
        }
      }
    }
  }
  contact_meta: Meta {
    Modules(filter: { api_name: "Contacts" }) {
      _data {
        plural_label
        id
        api_name
        module_name
        description
        singular_label
        fields(filter: { api_names: ["Last_Name", "Email"] }) {
          _data {
            id
            api_name
            display_label
            json_type
            data_type
          }
        }
      }
    }
  }
  deal_meta: Meta {
    Modules(filter: { api_name: "Deals" }) {
      _data {
        plural_label
        id
        api_name
        module_name
        description
        singular_label
        fields(
          filter: { api_names: ["Expected_Revenue", "Deal_Name", "Stage"] }
        ) {
          _data {
            api_name
            id
            display_label
            json_type
            data_type
          }
        }
      }
    }
  }
}


If you were to fetch this data using REST APIs, it will involve multiple calls to the 
  • Query API
  • Related Records API
  • Modules meta API, and 
  • Fields meta API.
Using the GraphQL query you can fetch the required data alone in a less round trip time. While constructing a query for your custom requirement, please note that you can query up to three levels of depth (nesting levels of a field) for Records and 7 levels of depth for Metadata. 

Constructing GraphQL query using Postman

To construct a GraphQL query in Postman to suit your requirements, type {api_domain}/crm/graphql in the URL box. Postman will automatically fetch the query schema in the schema explorer, which can be used to explore the types of queries that can be made, including what fields are available on each type, what arguments those fields accept, and what other types they return.   
Constructing a Zoho CRM GraphQL query in Postman using schema explorer



You can refer to the help documentation on GraphQL APIs for more details on GraphQL APIs. 

Notes
Update 25th Sep 2024:
GraphQL APIs are now open across all DCs including IN DC for Enterprise, Zoho One Enterprise, CRM Plus and Ultimate edition orgs. Please note that GraphQL APIs are not available for Trial Edition of these editions.



We hope you found this post useful. We will meet you next week with another interesting topic!
If you have any questions, let us know in the comment section or reach out to us directly at support@zohocrm.com.

Idea
Further Reading.                                                                                                                                



    Access your files securely from anywhere


            All-in-one knowledge management and training platform for your employees and customers.






                                  Zoho Developer Community




                                                        • Desk Community Learning Series


                                                        • Digest


                                                        • Functions


                                                        • Meetups


                                                        • Kbase


                                                        • Resources


                                                        • Glossary


                                                        • Desk Marketplace


                                                        • MVP Corner


                                                        • Word of the Day


                                                        • Ask the Experts



                                                                  • Sticky Posts

                                                                  • Kaizen #198: Using Client Script for Custom Validation in Blueprint

                                                                    Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
                                                                  • Kaizen #226: Using ZRC in Client Script

                                                                    Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
                                                                  • Kaizen #222 - Client Script Support for Notes Related List

                                                                    Hello everyone! Welcome to another week of Kaizen. The final Kaizen post of the year 2025 is here! With the new Client Script support for the Notes Related List, you can validate, enrich, and manage notes across modules. In this post, we’ll explore how
                                                                  • Kaizen #217 - Actions APIs : Tasks

                                                                    Welcome to another week of Kaizen! In last week's post we discussed Email Notifications APIs which act as the link between your Workflow automations and you. We have discussed how Zylker Cloud Services uses Email Notifications API in their custom dashboard.
                                                                  • Kaizen #216 - Actions APIs : Email Notifications

                                                                    Welcome to another week of Kaizen! For the last three weeks, we have been discussing Zylker's workflows. We successfully updated a dormant workflow, built a new one from the ground up and more. But our work is not finished—these automated processes are


                                                                  Manage your brands on social media



                                                                        Zoho TeamInbox Resources



                                                                            Zoho CRM Plus Resources

                                                                              Zoho Books Resources


                                                                                Zoho Subscriptions Resources

                                                                                  Zoho Projects Resources


                                                                                    Zoho Sprints Resources


                                                                                      Qntrl Resources


                                                                                        Zoho Creator Resources



                                                                                            Zoho CRM Resources

                                                                                            • CRM Community Learning Series

                                                                                              CRM Community Learning Series


                                                                                            • Kaizen

                                                                                              Kaizen

                                                                                            • Functions

                                                                                              Functions

                                                                                            • Meetups

                                                                                              Meetups

                                                                                            • Kbase

                                                                                              Kbase

                                                                                            • Resources

                                                                                              Resources

                                                                                            • Digest

                                                                                              Digest

                                                                                            • CRM Marketplace

                                                                                              CRM Marketplace

                                                                                            • MVP Corner

                                                                                              MVP Corner









                                                                                                Design. Discuss. Deliver.

                                                                                                Create visually engaging stories with Zoho Show.

                                                                                                Get Started Now


                                                                                                  Zoho Show Resources

                                                                                                    Zoho Writer

                                                                                                    Get Started. Write Away!

                                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                                      Zoho CRM コンテンツ




                                                                                                        Nederlandse Hulpbronnen


                                                                                                            ご検討中の方





                                                                                                                      • Recent Topics

                                                                                                                      • 📣 Ask the team behind Zoho SalesIQ: Summer '26 Q&A

                                                                                                                        Hi everyone! Following our recent webinars, Summer '26 Release: What's New in Zoho SalesIQ—where we walked you through all the new features, what they do, and how they work—and Driving the AI Evolution: Building Smarter Customer Experiences with Zoho
                                                                                                                      • Always display images from this sender – Is this feature available?

                                                                                                                        In Zoho mail, I had my "Load external images" setting set to "Ask me", and that's fine. That's the setting I prefer. What's not fine though is I always need to tick "Display now" for each email I get, regardless if I've done that multiple times from several
                                                                                                                      • Set Custom Icon for Custom Modules in new Zoho CRM UI

                                                                                                                      • Displayed sample tracking for multi branch setup.

                                                                                                                        We have multiple branches and one of the biggest challenges for us to be able to track if a particular item is in display or not. I am shooting in the dark but I am wondering if there is a solution for the following : Each product used for display is
                                                                                                                      • How do I migrate from Office 365 to Zoho Mail?

                                                                                                                        Check out Advik Email Migration Wizard, this software is specially developed to move mailboxes from Office 365 to Zoho Webmail. In addition you can migrate from Gmail, Yahoo, Rediffmail and 80+ webmail servers to ZOHO MAIL. Isn't it amazing? This is an all in one email migration solution. Steps to export emails from Office 365 to Zoho Webmail are as follows; Run Advik Email Migration Tool in your system. Select Office 365 as source and enter its login credentials. Select mailbox folders and choose
                                                                                                                      • Connection Issues

                                                                                                                        Morning. Seems like a few of my colleagues that are offsite are having issues with connection to cliq, even when their internet is working perfectly fine and only 1 person onsite has issues. Can you please explain? Thanks
                                                                                                                      • Goals API - Zoho People

                                                                                                                        Hi Team, I would like to get the API details for retrieving organisation-wise Goals from Zoho People. Currently, I am able to retrieve individual employee goals using the following API: https://people.zoho.com/api/v3/performance/goal/{emp_id} However,
                                                                                                                      • Backorder process review - Automating Removal of Sales Order from "On Hold" When PO is Received

                                                                                                                        Hello Zoho Inventory Team, Currently, sales orders in On Hold status are released only when the bill for the purchase order is created. In our workflow, it would be much more efficient if the sales order could automatically move out of On Hold as soon
                                                                                                                      • Cliq iOS can't see shared screen

                                                                                                                        Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
                                                                                                                      • Which Is the best online store to buy office furniture in Australia ?

                                                                                                                        The most important part of your office is the office furniture. Your office is not complete when you have not put the required furniture in place. You need a furniture in your office so that you and your employees have desks, tables, and chairs which
                                                                                                                      • Add "Product Code" as available column and search criteria for Assemblies

                                                                                                                        Hi Zoho Community. For product (item) assemblies, it would be helpful to be able to create a custom view search criteria that limits the view by product code or perhaps product category. Currently, Product Code is not an available option to display as
                                                                                                                      • What's New - July 2026 | Zoho Backstage

                                                                                                                        Hello everyone, We hope you’re having an expectation-exceeding event experience! We’ve been hard at work bringing you a bunch of enhancements designed to make event management even easier. Let’s take a look at what’s new in Zoho Backstage. Export delivery
                                                                                                                      • Delete Field that is used in a Zoho Flow connection

                                                                                                                        I'm trying to delete a Field used in a Webhook created by Zoho Flow with CRM Connection and i get the following alert: When going to the alert i get to the following issue, can't edit it since its been deployed by a pluggin But yes i have here the prompted
                                                                                                                      • Q3 USA ZUG Meetups - Build AI Agents with Zoho

                                                                                                                        Hi everyone! What if you could build your own AI agent from scratch in just one session? That's exactly what we're going to do at the upcoming ZUG Meetups across the United States, where you'll get hands-on experience with Zia Agents and explore how AI
                                                                                                                      • Data Export is forcing Creation/Modified date just like reports

                                                                                                                        The data export now forces you to select a created or modified date. There is not an All-Time option. This severely cripples the whole function of data export for audit purposes. If the data export (or reports for that matter), requires a date, there
                                                                                                                      • Default ticket template in helpcenter

                                                                                                                        Hello, I have a web form and a ticket template created. How can I make that my default ticket template? If an user clicks New ticket or create a ticket, I want that template to be the default one. Thank you for the time and info.
                                                                                                                      • Zia Agents looks promising, but I still cannot deploy my first agent or connect WhatsApp after weeks of support tickets

                                                                                                                        Hi Everyone, I am posting here because I am stuck and need practical help from someone who has successfully deployed a Zia Agent with WhatsApp. Zia Agents looks like a very promising product. I have watched the platform expand quickly, and I have noticed
                                                                                                                      • Valid characters for use in email addresses using Zoho's apps/APIs

                                                                                                                        We have found an issue with the + sign character in zoho subs - we are allowed to create a customer with an email address that has a plus sign but the API doesn't allow the + so the billing portal is not created. We are going to prevent users from using
                                                                                                                      • Feature Request – Per-Channel Pre-Chat Form Controls

                                                                                                                        We'd like the ability to enable/disable the pre-chat form on a per-channel basis, rather than having a single global setting. On the website widget, asking for name and email before chat starts makes sense. On WhatsApp, however, email isn't necessary
                                                                                                                      • Remove the mandatory Name Card buttons (or at least make them optional)

                                                                                                                        Please remove the mandatory Name Card buttons (or at least make them optional) A recent change to the Name Card in Zoho SalesIQ (currently affecting WhatsApp) introduced mandatory buttons before a visitor can provide their name. I believe this change
                                                                                                                      • Copy + Paste in Notes: Text color and text background are not retained

                                                                                                                        I've recently started using Zoho Notebook as an Evernote replacement. When copying and pasting text within Zoho Notes, I notice that the formatting of the text (text color and background color) is not retained when pasting. Only the attributes "Bold"
                                                                                                                      • Need to show discount before total after subtotal

                                                                                                                        Need to show discount before total after subtotal on my estimate template (see attachment)
                                                                                                                      • Google Ads Data is Publicly available in Zoho CRM

                                                                                                                        We recently discovered that ALL of the following Google Ads fields are visible to all users in our CRM that have access to either Leads or Contacts modules. Not only is this troubling and inconvenient, it should be unacceptable. It also creates a mess
                                                                                                                      • Zoho Books bill pay option not available with zoho one

                                                                                                                        Why isn't Zoho Books bill pay add-on not available for Zoho one customers not even as a purchasable option. I think this is very inconvenient for companies wanting to use this feature all in one system
                                                                                                                      • Bounce rates

                                                                                                                        Where can I see my bounce rates for: 1. Each email I send out, and 2. in total?
                                                                                                                      • Appointment- colour code

                                                                                                                        This is a real world problem for many companies. We track several employees appointments and this is done by one person so one account. The calendar layout is not great but if we could just colour code appointments to make it easier to see and then what about printing out the diary. I know in the IT world everybody is connected but so many of use still use old technology- paper.
                                                                                                                      • Add a Parameter to the ZOHO CRM Deluge sendmail to denote priority (defaulting to normal if unspecified)

                                                                                                                        Hello! There is a similar thread for Creator out there that is 2 years old, but I'd like to raise it in the ZOHO CRM category as well. Would you kindly update the existing Deluge sendmail function to allow a priority parameter? The parameter should allow
                                                                                                                      • Email outbox is now available in the sandbox

                                                                                                                        Hello all! Testing emails without visibility has always been a blind spot in the sandbox. With the new Outbox, that gap is closed. You can now view and verify every email triggered from your sandbox, whether it’s through workflows, approvals, or mass
                                                                                                                      • Transform your line of items into line items: ICR can now record your table values as subform values

                                                                                                                        Enhancement in Zoho CRM Dear Customers, We hope you're well! Zia Vision’s ICR capability can now recognize, extract, and store tabulated values in your subforms. An ideal example is a university application form. It has printed fields and handwritten
                                                                                                                      • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                                                                                                        so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                                                                                                      • Add the ability to Hide Pages in Page Rules

                                                                                                                        Hi, We have Field Rules to show and hide fields and we have page Rules, but we can't hide a page in Page Rules so it isn't completed before the previous page (And then have the Deny Rules to prevent submitting without both pages completed), we can only
                                                                                                                      • Calendar Year View?

                                                                                                                        Is there a way I can view the calendar in year view? Maybe create a page with a view like this?
                                                                                                                      • Automation Series: Auto-update Project End Date When a Task is Rescheduled

                                                                                                                        When a project is planned, tasks are scheduled within the projects timeline. Any delay in the predecessor tasks can delay dependent tasks, which can in turn impact the project timeline. Unless the project is manually rescheduled, the end date might not
                                                                                                                      • What is a realistic turnaround time for account review for ZeptoMail?

                                                                                                                        On signing up it said 2-3 business days. I am on business-day 6 and have had zero contact of any kind. No follow-up questions, no approval or decline. Attempts to "leave a message" or use the "Contact Us" form have just vanished without a trace. It still
                                                                                                                      • Zoho Social | Instagram Integration in Zoho Desk

                                                                                                                        Good day Zoho team! I have a question. If we link the Instagram business account to our Facebook page, and we integrate the Facebook to Social in Zoho Desk, the "Messages" from Facebook will be converted into Ticket right? Does it also convert the Instagram
                                                                                                                      • Rich-text fields in Zoho CRM

                                                                                                                        Moderation Update: During the initial release of Rich Text fields, it was supported only in the Enterprise and Ultimate editions. We have gradually extended Rich Text fields to all the paid editions of Zoho CRM. Hello everyone, We're thrilled to announce
                                                                                                                      • Tip #52: Practical uses of Zia Search in Zoho Sprints

                                                                                                                        If your agile team uses multiple Zoho apps, your team members might often find themselves switching between those apps looking for related information. When the data you're looking for is spread across different workspaces within Zoho environment, rely
                                                                                                                      • New field in Zoho Forms: Validate structured data with the Regex field

                                                                                                                        Have you ever received form submissions where the information looked almost correct but wasn't quite in the format you expected? Maybe an employee ID was missing a character. A PAN number was entered in lowercase. A license number had an extra space.
                                                                                                                      • Import Excel from email into CRM

                                                                                                                        I receive a daily Excel file by email and I would like to have it automatically imported into a custom Zoho CRM module. Do you think there's anything that can be done? My first idea was searching for a native option in CRM, such as "send an email to a
                                                                                                                      • Zoho Connect is now even smarter and more personalized

                                                                                                                        Hello everyone, We’re excited to introduce new features and enhancements to help you personalize the employee experience, connect workplace knowledge with AI, and create more engaging dashboards. Deliver relevant dashboards with Audience With Audience,
                                                                                                                      • Next Page