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;