Kaizen #202 - Answering Your Questions | Testing and Using REST APIs in Widgets

Kaizen #202 - Answering Your Questions | Testing and Using REST APIs in Widgets



Hello Developers!

Welcome back to a fresh week of Kaizen! 

Thank you for your active participation in sharing feedback and queries for the 200th milestone. This week, we will look at the following queries related to widget:
  • Widget Testing 
  • Using REST API in Canvas Widgets: Make HTTP calls in widgets (e.g., to external tax or product APIs)
Here are the queries that we have already answered for you from this milestone:
  1. Kaizen #200 - Answering Your Questions | Token generation using the Python SDK
  2. Kaizen #201 - Answering Your Questions | Webhooks, Functions, and Schedules

Widget Testing

One of the queries we received was simply stated
Quote
Widget Testing
 without any specific context. Since the user has not provided detailed input, we are assuming this is about how to test a widget during development.

You can test your Zoho CRM widget locally using the Zoho CLI. Run the following command from the root directory of your widget project:

zet run

This launches the widget on a local server where you can validate the UI and functionality before pushing it live.


Since the localhost connection opens in a new tab and is not private, you will need to manually authorize it. 

Click Advanced, then choose Proceed to 127.0.0.1 (unsafe) to continue. 

Notes
Note

If your widget needs to access data from your Zoho CRM organization, such as fetching or updating records, it must be deployed within a Zoho CRM iframe. To do this, you should upload the widget through the Zoho CRM Widgets setup page.

We recommend using the sandbox environment in such cases before deploying the widget to your production environment.

Making HTTP Calls from Widget

Following is a query we received from a user:
Quote
Using REST API in Canvas Widgets: Make HTTP calls in widgets (e.g., to external tax or product APIs)
Yes. You can make HTTP requests to external services from any type of Zoho CRM widget using the ZOHO.CRM.HTTP object from the Widget JS SDK.

Canvas Widget - What's Supported? 

Though full widget support within Canvas is on our roadmap, currently, you can invoke widgets from a Canvas view using Client Script. This lets you render widgets inside fly-outs or pop-ups. Here is a quick start guide on how you can achieve it:

Create a Widget

1. Create a widget project and code your logic using Zoho CLI as explained in our widget help page.

2. In Zoho CRM Developer Hub, create a new widget and set the type as Button.



Create a Client Script

3. Navigate to Client Scripts in Developer Hub and click New Script.

4. You can create your script either in the Modules or Commands category based on your use case. 

For assistance, refer to the step-by-step guide on Creating Client Script and Commands.



In the Category Details section, ensure to select Canvas as the page type. Canvas views are supported in the following page contexts: List, Detail, Create, and Clone. 

Choose the one that aligns with where your widget needs to appear.


5. Here is the sample script to render widget in a pop-up

ZDK.Client.openPopup({
api_name: 'Canvas_Widget',
type: 'widget',
animation_type: 4, 
height: '450px',
width: '450px',
},
{
data: 'sample data to be passed to "PageLoad" event of widget'
}); 

Here is the sample script to render widget in a fly-out

ZDK.Client.createFlyout('myFlyout', { 
animation_type: 4, 
height: '600px', 
width: '500px'
}
);
ZDK.Client.getFlyout('myFlyout').open({ api_name: 'Canvas_Widget', type: 'widget' });

For detailed guidance, check out our Client API documentation on Pop-up and Fly-out.

You can also check out the Kaizen #99 on Rendering Widgets using Client Script for a detailed guide based on a real-time use case. 

Using REST APIs from External Applications

The ZOHO.CRM.HTTP object enables you to make secure API calls directly from the Zoho CRM widget. It acts as a proxy, routing requests through Zoho servers, which eliminates the need for external applications to support CORS.

While this SDK is primarily used for integrating third-party services, it also supports Zoho CRM API calls. This provides you with greater flexibility to:
  • Customize header and parameter structures
  • Maintain a consistent calling pattern for both internal and external APIs within the widget.
Here is a basic syntax of the SDK:

ZOHO.CRM.HTTP.<method>({
  url: "<request-url>",
  headers: {
       // Request headers as Key-value pairs
    "Authorization": "Bearer <token>" // example
  },
  params: {
    // Request params as Key-value pairs

   "ids": "1234567890" // example
  },
  body: "<stringified JSON>", // Required for POST, PUT and PATCH
})
.then(function(response) {
  console.log("Response:", response);
});

Supported Methods
  • ZOHO.CRM.HTTP.get({ ... })
  • ZOHO.CRM.HTTP.post({ ... })
  • ZOHO.CRM.HTTP.put({ ... })
  • ZOHO.CRM.HTTP.patch({ ... })
  • ZOHO.CRM.HTTP.delete({ ... })
For more detail check out the HTTP method section of JS SDK help page.

Samples using Zoho CRM Contact Roles API

Let us explore a complete CRUD (Create, Read, Update, Delete) example using Zoho CRM’s Contact Roles API.

These structures have to be used within the JS function where you are executing your code logic. 

POST Contact Roles


// Prepare the API request
        var request = {
          url: "https://www.zohoapis.com/crm/v8/Contacts/roles",
          headers: {
            Authorization: "Zoho-oauthtoken 1000.XXXXXXXXXXXXXXXXXXX265bcf20e4"
          },
          body: {
            "contact_roles": [
              {
                "name": "Sales Lead",
                "sequence_number": 1
              }
            ]
          }
        };
         // Make API call 
        ZOHO.CRM.HTTP.post(request).then(function(data) {
          console.log(data);
 })

GET Contact Roles


// Prepare the API request
var request = {
          url: "https://www.zohoapis.com/crm/v8/Contacts/roles",
          headers: {
            Authorization: "Zoho-oauthtoken 1000.XXXXXXXXXXXXXXXXXXX265bcf20e4"
          }
        };
        // Make API call 
        ZOHO.CRM.HTTP.get(request)
          .then(function(response) {
 console.log(response);
})

UPDATE Contact Roles

// Prepare the API request
        var request = {
          headers: {
            Authorization: "Zoho-oauthtoken 1000.XXXXXXXXXXXXXXXXXXX265bcf20e4"
          },
          body: {
            "contact_roles": [
              {
                "name": "Evaluator",
                "id": "5545974000000006871"
              }
            ]
          }
        };
        // Make API call 
        ZOHO.CRM.HTTP.put(request).then(function(data) {
          console.log(data);
 })

DELETE Contact Roles


// Prepare the API request
        var request = {
          params: {
            ids: "5545974000002617002"
          },
          headers: {
            Authorization: "Zoho-oauthtoken 1000.XXXXXXXXXXXXXXXXXXX265bcf20e4"
          }
        };
        // Make API call 
        ZOHO.CRM.HTTP.delete(request).then(function(data) {
          console.log(data);
 })

We hope you found this post useful. 

Let us know if you have any questions in the comments or drop us an email at support@zohocrm.com.

Cheers!

------------------------------------------------------------------------------------------------------------------------

Related 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

                                                                                                                • How to keep track of bags, cans, drums of inventory?

                                                                                                                  We buy and sell products that are packaged in bags 🛍️, cans🥫, drums🛢️, etc. with batch numbers. When we get a shipment of one of the products, how do we track we received (say) 10 cans each of 5L of a product and maybe we received 10 cans of another
                                                                                                                • Global/Overall Reports & Dashboards in Zoho Sprints

                                                                                                                  Hi, Do we have an option to refer Global Level Reports & Dashboards in Zoho Sprints? We could see that we have Project specific Reports & Dashboards inside every Project. However, for a management level we want Reports & Dashboards visibility at a Global
                                                                                                                • Important Update: New Fields Addition in Zoho Sprints Integration

                                                                                                                  We'd like to inform you of an upcoming update to the 'Timesheets' module in the Zoho Sprints integration from June 3, 2026. To enhance time tracking and reporting accuracy for the Zoho Sprints integration, three new fields - Log Type, Meeting ID, Release
                                                                                                                • Custom Buttons & Links Now Supported in Portals

                                                                                                                  We’ve just made portals in Zoho Recruit more powerful and customizable than ever! You can now bring the power of Custom Buttons and Links to your Candidate, Client, Vendor, and Custom Portals, enabling portal users to take direct action without recruiter
                                                                                                                • Packaged Weight And Dimensions

                                                                                                                  Hello, we have item weight and dimensions, please add packaged weight and dimensions. Thank you
                                                                                                                • Nome do Agente não aparece nas conversas do whatsapp para o nosso cliente

                                                                                                                  Nome do Agente não aparece nas conversas do whatsapp para o nosso cliente! Isso é ruim pois so,os em 5 agentes e o cliente fica sem saber com quem ele está falando, pois tentei procurar configurações que pudessem ter esta opção, mas até então não encontrei.
                                                                                                                • Marketing Plus : quatre ans à réinventer la simplicité des opérations marketing

                                                                                                                  Pourquoi et comment ? Il y a exactement quatre ans, nous avons démarré simplement, avec une seule vision: unifier et simplifier les opérations marketing pour les équipes marketing de tous les secteurs. Chez Zoho, nous proposons des outils dédiés à chaque
                                                                                                                • hide resolution from help centre

                                                                                                                  to my surprise, i just found out that the resolution text is public in the helpcenter, even if 'notify customer' is off. is there a workaround to that? how do others deal with this? How zoho support does this and I don't think its used by Zoho in the first place. the resolution is meant to be private, not public
                                                                                                                • Zoho Desk - Event Calendar View

                                                                                                                  Hi Desk team, Are there any plans to introduce a calendar or timeline view for Events in Zoho Desk? It would be very helpful if we could see Events visually in a calendar and/or timeline. This is very helpful when desk side support activities need to
                                                                                                                • Pasting Images in Zoho Desk ignores cursor location

                                                                                                                  My team has reported an issue which started recently where when we paste an image into a new or existing reply or comment, the pasted image seems to ignore the current cursor location instead paste itself at the last character present in the reply/comment,
                                                                                                                • Enrich your contact and company details automatically using the Data Enrichment topping

                                                                                                                  Greetings, I hope you're all doing well. We're happy to announce the latest topping we've added to Bigin: The Data Enrichment topping, powered by WebAmigo. This topping helps you automatically enhance your contact and company records in Bigin. By leveraging
                                                                                                                • Financial manger

                                                                                                                  why is transaction locking for zoho I Can't closing period
                                                                                                                • API usage

                                                                                                                  My application has bad implementation and code that is resulting in very high API usage. This is my first time experiencing something like this. Does anyone know how I can troubleshoot and fix this?
                                                                                                                • Disabled page

                                                                                                                  Hello, When I try to to run Inventory Valuation Summary and FIFO Cost Lot Tracking reports, I get This page is disabled error. I tried everything in settings, cant find the settings to enable. Help me.
                                                                                                                • Setting defaults for "Find and Merge Duplicate for..."

                                                                                                                  To remove some of the extreme tedium from Zoho's poorly implemented merge function, I would like to set defaults.  Currently I am defaulted to match "ANY" when I would never do that, so I always have to click "ALL". Then it makes me click on several totally irrelevant drop boxes to turn off phone, mobile and other useless match criteria. Is there a way I can set: Match to default as "ALL" Firstname to default to "IS" Lastname to default to "IS" every other match field default to "-NONE-" This will
                                                                                                                • Linux agent 2026_M05 release notes

                                                                                                                  Agent Version: 3.6.5.3 Release date: 28 April, 2026 Major Enhancement: Quick Support feature release. Security improvements and enhancement to in session features.
                                                                                                                • Automated Sales Order Fulfillment Based on Inventory Availability (Allocation / Commitment Modes)

                                                                                                                  Hi everyone, I recently reached out to Zoho Inventory support regarding a workflow challenge and wanted to share both the issue and their response here for visibility. Zoho confirmed: “Zoho Inventory does not currently support automatic notifications
                                                                                                                • Linux agent 2026_M04 release notes

                                                                                                                  Agent Version: 3.6.5.2 Release date: 30 April, 2026 Code refactoring and improvements to function efficiently in minimal hardware environments.
                                                                                                                • Simple Totals on all pages?

                                                                                                                  Hi there. I'm surprised this isn't implemented yet (since most other software has this by default). Can you display a simple total at the bottom of all invoice lists? ie: I click in SALES tab, select INVOICES and on that page please show us a simple total? Yes, I realize I can go the long way around and generate reports and select my date options and select the type of invoices etc...but honestly that shouldn't be necessary when just viewing a list of unpaid invoices and how much total is outstanding.
                                                                                                                • Linux agent 2026_M03 release notes

                                                                                                                  Agent Version: 3.6.5.1 Release date: 27 February, 2026 Bug fixes and performance improvements for optimised session experience.
                                                                                                                • Linux agent 2026_M02 release notes

                                                                                                                  Agent Version: 3.6.5.0 Release date: 26 February, 2026 Major enhancement: File Manager feature release Issue fixing of idle session timing interfering with backend activities.
                                                                                                                • Linux agent 2026_M01 release notes

                                                                                                                  Agent Version: 3.6.4.8 Release date: 13 February, 2026 Optimised the unattended agent uninstallation process to properly cleanup residual files and complete uninstallation process. Fixed issues with CTRL+ALT+DEL command not functioning properly in some
                                                                                                                • Using API for multiple organizations

                                                                                                                  I am busy building an app to load data from a retailer into Zoho Books. We are planning on selling the app to multiple organizations that use this retailer. Is there a way to get a single oauth app to access multiple organizations? From what I can find
                                                                                                                • MacOS agent 2026_M04 release notes

                                                                                                                  Agent Version: 3.120.0 Release date: 23 April, 2026 Retry mechanism for end users to enable Accessibility and Screen Share permissions to successfully join remote sessions. Agent stickiness on multiple desktops to avoid confusion. Improvements to audio
                                                                                                                • MacOS agent 2026_M03 release notes

                                                                                                                  Agent Version: 3.117.0 Release date: 02 March, 2026 Bug fixes and performance improvements for optimised session experience.
                                                                                                                • MacOS agent 2026_M02 release notes

                                                                                                                  Agent Version: 3.116.0 Release date: 23 February, 2026 Major enhancement: File Manager feature release Minor enhancement: Improved peer to peer connectivity across various network conditions. Minor enhancement: Improvements to Elevate to Admin mode
                                                                                                                • MacOS agent 2026_M01 release notes

                                                                                                                  Agent Version: 3.111.0 Release date: 11 February, 2026 Major Enhancement: Quick Support feature release. Upgrades to monitoring protocols for analysing performance. Issue fixing of idle session timing interfering with backend activities.
                                                                                                                • Account Unblock Request

                                                                                                                  Dear Sir/Madam, I hope you are doing well. I noticed that my account has been blocked for violation of the usage policy which I believe comes from it being associated with sending spam. I have since then removed the old keys which were compromised in
                                                                                                                • Kaizen #242 Enabling In-Context Order Creation from Deals Using SlyteUI

                                                                                                                  Hello everyone! Welcome to another interesting Kaizen post. Today’s spotlight is on SlyteUI, the new UI builder designed to create powerful, intuitive user interfaces in minutes. Built for speed and simplicity, SlyteUI empowers teams to deliver high-impact
                                                                                                                • Auto-sync field of lookup value

                                                                                                                  This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
                                                                                                                • CRM gets location smart with the all new Map View: visualize records, locate records within any radius, and more

                                                                                                                  Hello all, We've introduced a new way to work with location data in Zoho CRM: the Map View. Instead of scrolling through endless lists, your records now appear as pins on a map. Built on top of the all-new address field and powered by Mappls (MapMyIndia),
                                                                                                                • Can't access google from toppings menu

                                                                                                                  So... When I click the manage button in toppings, nothing happens. it won't let me access the settings.
                                                                                                                • Best sales insights for target accounts?

                                                                                                                  Question for all the sales power-users out there: I would like to gain insights from Zoho CRM for a rotating list of target accounts. Each Outside Salesperson has 5 target accounts, and they can change these targets quarterly with management approval.
                                                                                                                • Emails Disappearing From Inbox

                                                                                                                  I am experiencing the unnerving problem of having some of the messages in my inbox just disappear.  It seems to happen to messages that have been in there for longer than a certain amount of time (not sure how long exactly). They are usually messages that I have flagged and know I need to act on, but have not gotten around to doing so yet.  I leave them in my inbox so I will see them and be reminded that I still need to do something about them, but at least twice now I have opened my inbox and found
                                                                                                                • Cadence not stopping on reply (in some cases) – anyone else?

                                                                                                                  Hi everyone, we’ve noticed that in a few cases, Cadences don’t stop even though the contact replied (setting “stop on reply” is active). It works fine most of the time, but occasionally the reply is visible in CRM without stopping the Cadence. Our assumption
                                                                                                                • Issue with Resume Parsing and Storage Limit in Zoho Recruit

                                                                                                                  Hello Team, We are currently facing an issue with resume parsing in Zoho Recruit. While parsing resumes, we are receiving a message indicating that the storage is full. We would like to delete multiple old resumes from the system to free up storage space.
                                                                                                                • BUG: Related List Buttons with Client Script action now erroring

                                                                                                                  There appears to have been a bug introduced over the last few days with Related List buttons that invoke a Client Script action. Button configuration: Configured Client Script: Results: The default loader is presented at the top of the page, and an error
                                                                                                                • SalesIQ Email Delivery Issues to Microsoft

                                                                                                                  Is anyone else having delivery issues to Hotmail, Outlook, and Live inboxes when sending transcripts and replies via email from SalesIQ? We’ve detected that emails sent from SalesIQ to these accounts aren't arriving—they don’t even bounce back; they simply
                                                                                                                • Introducing the revamped What's New page

                                                                                                                  Hello everyone! We're happy to announce that Zoho Campaigns' What's New page has undergone a complete revamp. We've bid the old page adieu after a long time and have introduced a new, sleeker-looking page. Without further ado, let's dive into the main
                                                                                                                • Multiple Pipelines

                                                                                                                  Is it possible to create multiple candidate pipelines?
                                                                                                                • Next Page