Zoho Creator JS API v1
Zoho Creator provides JS API v1 that allows you to perform CRUD operations from within a widget in your Zoho Creator applications. These JS API tasks are based on REST APIs v2.
The JS API v1 tasks you can write into your widget's JS file are:
- Data APIs - Add, fetch, update, delete, or get a count of the records in Zoho Creator.
- File APIs - Upload files into the records of a Zoho Creator application.
- Util APIs - Fetch query parameters of the page in which a widget is inserted, navigate to open URLs, and more.
JS API Configuration
To use the JS API tasks within your widget, you need to perform the following configurations in the HTML and JS file of the widget ZIP, respectively.
STEP 1 : To Be Done in Widget ZIP's HTML File
Include the CDN URL given below by linking it in the script tag of the widget's HTML file.
STEP 2 : To be Done in Widget ZIP's JS File
Initialize the SDK present in the CDN URL using the below method. You will have created a JS file inside your widget ZIP. This needs to be included in that JS file. Then, use block to write the logic for the JS API tasks in the same file.
.then(function(data) {
//Code goes here
});
Points to Note
Version-Wise Limitations
- The tasks that can be performed from within the widget are limited to the ones pertaining to JS API v1. For example, say you want to execute the JS API v2 Get Records task from within a widget. The records will be fetched only if you've provided the CDN URL pertaining to v2 in the widget's HTML file.
If you need to change the current JS API version to v2, the following changes have to be done:
- Change the CDN URL in the widget ZIP's HTML file to the v2.
- Remove the initialization method of v1 in the widget ZIP's JS file.
- Update the syntax and configuration parameters of the JS API tasks to match those of v2, in the widget ZIP's JS file.
The widget file needs to be re-uploaded afterwards. Keep in mind that after the CDN URL is updated, any tasks from the version used before will stop working.
General
- Make sure to provide the mandatory parameters necessary for a task in the configuration for the execution to be successful.
- The success of the API call to perform a task in an application depends on the permissions provided for the users who access the widget in the target application.
- Any direct changes to the JS script present in a widget's file will require re-uploading the modified file for the widget to work as required.