Get Records

Table of Contents

Overview

This JS API task fetches the records displayed by a published report. Its response will contain the data of all the visible fields present in the report's records. A maximum of 1000 records can be fetched per request.

This V2 task is based on the Get Records (Publish) REST API V2.1.

Request Details

Syntax

ZOHO.CREATOR.PUBLISH.getRecords(config).then(function(response){
   //callback block
});

Syntax Details

The syntax holds:

  • <config> (object) - The configuration required to get records from a published report. This configuration includes the following parameters.
NameTypeDescription
app_name
(Optional)
string

Link name of the application from which data needs to be pulled. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>

Note: This parameter only needs to be passed when you need to pull data from other applications in the same Creator account. When not specified, data will be pulled from the current application.
report_namestringLink name of the report from which the records have to be fetched. Retrieve the link name using the Creator report's URL: https://creatorapp.zoho.com/<account_name>/<app_name>/#Report:<report_name>
private_linkstringThe set of alphanumeric characters following the report link name in the permalink. It is the last path of the URL that is obtained after publishing the report. Retrieve private_link using the Creator report's permalink:
https://creatorapp.zohopublic.com/<account_name>/<app_name>/report-perma/<report_name>/<private_link>
criteria
(Optional)
stringThe criteria using which you want the API request to filter the target report. If not specified, the request will fetch the first 200 records from the report (as per its predefined sorting order).
Refer to the Defining the search criteria section to learn more.
field_config
(Optional)
string

Fetches fields of the records based on the input value.
Possible values:

Note: This API will not fetch the record displayed in the related data blocks of the detail view.

fields
(Optional)
string

If the value of field_config parameter is given as custom, this parameter should also be included. The required fields' link names need to be mentioned as individual comma-separated strings.

Note:

  • The field link names can be found in the field properties pane of each field in the form builder.
  • Hidden fields will not be fetched. Admin Only fields will be fetched only when the requesting user is an admin in that application.
  • When a subform field's link name is specified, all visible fields within will be fetched.
max_records 
(Optional)
int

The number of maximum records that will be fetched upon one request.
Possible values: 200, 500, 1000 (default value)

If the criteria parameter is mentioned, the maximum count will apply only for the records that match the criteria.

record_cursor
(Optional)
stringEvery time records exist beyond the maximum fetch count (1000), a unique key will be received in the response. This can be added in the next API call's <config> parameter as a key-value pair to fetch the consecutive batch of 1000 records, if they exist.

Possible Errors

Refer to this page for the complete list of error codes and messages.

Sample Input

Copiedvar config = {
  app_name: "zylker",
  report_name: "All-Timesheet",
  private_link: "1223456789poiuyytrewq",
};
ZOHO.CREATOR.PUBLISH.getRecords(config).then(function (response) {
  var recordArr = response.data;
  for(var index in recordArr){
     console.log(recordArr[index]);
   }
});

Sample Response

Copiedresponse  = {
   "code": 3000,
   "data": [{
       "ID": "2000000193171",
       "Name": {
         "first_name": "James",
         "last_name": "Kyle",
         "display_value": "James Kyle"
         }
     },
     {
       "ID": "2000000193173",
       "Name": {
         "first_name": "Zylker",
         "last_name": "James",
         "display_value": "Zylker James"
         }
     }]
 }