Zoho Creator JS API v2
Zoho Creator provides JS API v2 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.1.
The JS API v2 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.
- Publish APIs - Add or fetch records within published components in Zoho Creator.
- File APIs - Upload files into the records of a Zoho Creator application.
- Meta APIs - Fetch required meta information from Zoho Creator.
- 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.
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.
CDN URL for v2 - https://js.zohostatic.com/creator/widgets/version/2.0/widgetsdk-min.js
STEP 2 : To be Done in Widget ZIP's JS File
You will have created a JS file inside your widget ZIP to include interactive elements. Use block to write the logic for the JS API tasks in the same file.
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 v2. For example, say you want to execute the JS API v1 Get Records task from within a widget. The records will be fetched only if you've provided the CDN URL pertaining to v1 in the widget's HTML file.
If you need to change the current JS API version to v1, the following changes have to be done:
- Change the CDN URL in the widget ZIP's HTML file to v1.
- Add the initialization method required for v1 in the widget ZIP's JS file.
- Update the syntax and configuration parameters of the JS API tasks to match those of v1, 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.
- Only Publish API tasks will work in published pages that can be accessed by people who do not hold a Creator account.
- 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.