How To Call Post API Using Client Script

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 Identifying the URL of the POST API endpoint where you want to send data.

Step 2: Configure API Request Parameters

o API endpoint URL.

o Request headers (if required for authentication or specific content type).

o Request body: Construct the data you want to send in the POST request. This may be in JSON, XML, or other formats.

Step 4: Initiate the POST Request

o Initiate the POST request to the API endpoint.

Outcome:

Following these steps will enable your client script to effectively call the POST API, send data to the specified endpoint, and integrate the response into your application, enhancing its functionality and data capabilities.

Further Reading:

Sample URL : click here

Generate Access Token URL : click here

Sample Code :
#sample code for post-data

 let gstResponse = ZDK.HTTP.request({ url: ncValidateURL, method: "POST", content: JSON.stringify(data), headers: { 'Authorization': 'Bearer ' + accessToken, 'Content-Type': 'application/json' } });

        var statusCode = gstResponse.getStatusCode();

       var responseData = await gstResponse.getResponse();


    • Related Articles

    • 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 ...
    • 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, Update, Read and Delete records in Zoho CRM.

      If you want to Create, Update, Read and Delete records in Zoho CRM in any module, please use the following code for the same: Code: var commonname = value.id; var acc = ZDK.Apps.CRM.Accounts.fetchById(commonname); var phone = acc.MobileNo; var email ...
    • 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 ...