How To Call Get API Using Client Script

How To Call Get API Using Client Script

Task: To get a response from any endpoint through client script (real-time API call).

Prerequisites (if applicable):

1. API Structure.

2. Trigger Point.

Instructions:

Step 1: Identify the API Endpoint

Determine the URL of the GET API endpoint you want to call.

Step 2: Set Up API Request Parameters

Within the client script, define the API request parameters, including the URL, headers (if required), query parameters, and any authentication credentials needed to access the API.

Step 3: Make the GET Request

Write the code within the client script to make the GET request to the API endpoint.

Step 4: Error Handling

Include error-handling logic within your client script to handle cases where the API request fails or returns an error. You can display error messages or log errors for troubleshooting.

Outcome: Once you have completed these steps, your client script will be able to call the GET API and retrieve data from the specified endpoint. This data can then be used to enhance your application's functionality.

Further Reading:

Related articles with links CRM API URL: https://www.zoho.com/crm/developer/docs/api/v3/modules-api.html Generate Access Token URL: https://accounts.zoho.in/oauth/v2/token


#sample code for get data

let gstResponse = ZDK.HTTP.request({url:gstValidateURL,method: "GET",parameters:{'gstin':gstNo,'duplicateCheck':'true'},headers: { 'Authorization':'Bearer '+accessToken,'Content-Type':'application/json'}}).getResponse();

const responseObject = JSON.parse(gstResponse);

console.log(responseObject);

const reportStatus = responseObject.reportStatus;

const errorMessage = responseObject.errorMessage;

    • Related Articles

    • How To Call Post API Using Client Script

      Task: To post a response from any endpoint through client script (real-time API call). Prerequisites (if applicable): o API Structure. o Trigger Point. o Request Body o Request body require field. Instructions: Step 1: Identify the API Endpoint o ...
    • How to set a field as read-only using client script

      Task: Writing a client script for a different inbuild function based on different seniors/events. Prerequisites (if applicable): You should have a basic understanding of how to create and manage client scripts in your application. Instructions: Step ...
    • How to Populate City and State Based on Zip Code

      How to Populate City and State Based on Zip Code Task: We will be populating fields in Leads Module in Zoho CRM. The fields in this case are “City” and “State” based on the value of we put in Zip Code field. Prerequisites (if applicable): Client ...
    • How to Create an RFQ process in Zoho CRM.

      Task: A process to send RFQ (Request for Quote) to the vendor which is then filled by him to generate a RFQ record in Zoho CRM. (e.g., “By following the instructions, you’ll be able to achieve below steps smoothly” “This article will help you set up ...
    • How to Create a Task and Populate a Custom Date/Time Field with a TAT.

      Task: We first create a task based on lead status change. We will be then populating a custom date/time field which can be used as a TAT. The TAT will be adjusted according to the users shift hours and working days. Prerequisites (if applicable): ...