Create Bulk Read job (Bulk Export)

Create a bulk read job to export records.

Request URL

{api-domain}/bigin/bulk/v2/read

Choose domain-specific URL to replace {api-domain}

You can use the domain-specific URL to access Bigin resources. Based on the data center in which the Bigin account's resources are available, replace {api-domain} in the preceding request with one of the following API domain URLs:

  • For US, https://www.zohoapis.com
  • For EU, https://www.zohoapis.eu
  • For AU, https://www.zohoapis.com.au
  • For IN, https://www.zohoapis.in
  • For CN, https://www.zohoapis.com.cn
  • For JP, https://www.zohoapis.jp

For more information, see Multi DC Support.

 

Authorization

For this endpoint, pass the access token as an authorization header. See OAuth Authentication for more information about access tokens.

Authorization: Zoho-oauthtoken <ACCESS_TOKEN>

You must authenticate using an access token that is associated with the following scope:

  • ZohoBigin.bulk.READ and ZohoBigin.modules.{module_name}.ALL
  • ZohoBigin.bulk.READ and ZohoBigin.modules.{module_name}.READ

In the above scope, replace {module_name} with the necessary module. The possible modules include deals, contacts, accounts (companies in Bigin), products, calls, events, and tasks.

Sample request

Copiedcurl "https://www.zohoapis.com/bigin/bulk/v2/read" \
-X POST \
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf" \
-H "Content-Type: application/json" \
-d "@inputData.json"

Request parameters

Before you construct request body for bulk export, you should be familiar with the following:

Allowed Comparators

Data typeComparatorValue and limits
Number(Integer)/Decimal/BigInteger/ Currency/Percentequal, not_equal, in, not_in, less_than, less_equal, greater_than, greater_equalAny number values or ${EMPTY} for an empty value. Not more than 19 digits for big integer, decimal values for decimal and currency fields. In multi-currency enabled accounts, only the home currency value is supported.
Text (Email, Phone, URL, Picklist, Multi-select, etc)equal, not_equal, in, not_in, contains, not_contains, starts_with, ends_withAny text values or ${EMPTY} for empty value. Not more than 255 characters.
Date and DateTimeequal, not_equal, in, not_in, between, not_betweenAny date values in the ISO 8601 format or ${EMPTY} for an empty value. For DateTime fields, milliseconds is not supported.
BooleanequalTrue or false
Lookupequal, not_equal, in, not_inBig integer value of the lookup, ${EMPTY} for empty value, or use the .(dot) operator to establish a relation between two modules. Example: "Owner" fetches the ID of the Owner, whereas "Owner.last_name" fetches the last name of the owner. "Account_Name" fetches the ID of the Account associated with the base module, whereas "Account_Name.Phone" fetches the phone number of the account associated with the base module.

The available request parameters are given below:

Body parameters

callback jsonobjectOptional

The JSON object represents the following details of a bulk read job.

url string

A valid URL, that should allow HTTP Post method. The Bulk Read Job's details is posted to this URL on successful completion of job or on failure of job.

method string

The HTTP method of the callback url. The supported value is post.

query jsonobjectOptional

Represents the JSON object that holds the keys and their value that form the criteria for bulk export. The following are the keys in the JSON object:

module stringRequired

Represents the API Name of the module you want to export the records from. Specify the module name as "Events" if you want to export the records in the Events module as an ICS file.

cvid stringRequired

Represents the unique ID of the custom view when you want to export records in a custom view. You can obtain the cvid from the Custom View Metadata API.

file_type stringRequired

Specify the value for this key as "ics" to export all records in the Events module as an ICS file. Use this mandatorily when you want to export the events as an ICS file.

fields jsonarrayOptional

Represents the API name of the fields that you want to export. For instance, First_Name, Last_Name, Email, Owner.last_name, and so on. Do not input this key when you want to export the records in the Events module as an ICS file.

page integerOptional

The default value is 1 and means that the first 200,000 records matching your query will get exported. If you want to fetch the records from the range 200,001 to 400,000, then mention the value as '2'.

criteria jsonobjectOptional

Represents the details that the system uses to filter records.Ex: The API Name of a module or field, comparators used to add two or more criteria, a group which the record/module/field belongs to etc. the following are the keys of this JSON object:

group_operator string

Represents the Logical operators. Supported values - and, or.

This is mandatory if api_name, comparator and value are not specified.

group jsonarray

Represents the array of criteria objects. Each object in the criteria has the following keys:

This is mandatory if api_name, comparator and value are not specified.

api_name string

Here in this example the key is given as a part of "group" JSON array. You can also specify it directly inside the criteria JSON object. The key represents the API name of a field to be compared. For instance: First_Name, Last_Name, Owner.last_name etc.

This is mandatory if group and group_operator are not specified.

value string/jsonarray

Here in this example the key is given as a part of "group" JSON array. You can also specify it directly inside the criteria JSON object. The key represents the value with which the records must be filtered.

This is mandatory if group and group_operator are not specified.

comparator string

Here in this example the key is given as a part of "group" JSON array. You can also specify it directly inside the criteria JSON object. The key represents the comparator. Example: equal, greater_than. The following table shows the supported comparators.

This is mandatory if group and group_operator are not specified.

Sample request body with lookup fields

Copied{
  "callback": {
    "url": "https://www.example.com/callback",
    "method": "post"
  },
  "query": {
    "module": "Contacts",
    "fields": [
      "Last_Name",
      "Owner",
      "Owner.last_name",
      "Account_Name.Account_Name",
      "Account_Name.Phone",
      "Created_Time"
    ],
    "criteria": {
      "group_operator": "or",
      "group": [
        {
          "api_name": "Owner.last_name",
          "comparator": "equal",
          "value": "Boyle"
        },
        {
          "api_name": "Account_Name.Phone",
          "comparator": "contains",
          "value": "5"
        }
      ]
    },
    "page": 1
  }
}

This query fetches records based on the specified criteria and the "."(dot) operator is used to fetch data from the parent modules. Account_Name is the default lookup field in the Contacts module. Here, Owner.last_name returns the last name of the owner of the contact, Account_Name returns the ID and Account_Name.Account_Name returns the name of the account associated with the contact, and Account_Name.Phone returns the phone number of the account associated with the contact.

Sample request with cvid and criteria

Copied{
  "callback": {
    "url": "https://www.example.com/callback",
    "method": "post"
  },
  "query": {
    "module": "Accounts",
    "cvid": "554023000000093005",
    "fields": [
      "Account_Name",
      "Owner",
      "Owner.last_name",
      "Created_Time"
    ],
    "criteria": {
      "api_name": "Owner.last_name",
      "comparator": "equal",
      "value": "Patricia Boyle"
    }
  }
}

Sample request body to export meetings in the ICS format

Copied{
    "query": {
        "module": "Events",
        "criteria": {
            "group": [
                {
                    "group": [
                        {
                            "api_name": "All_day",
                            "comparator": "equal",
                            "value": "false"
                        },
                        {
                            "api_name": "Owner",
                            "comparator": "in",
                            "value": [
                                "554023000000695002",
                                "554023000000691003"
                            ]
                        }
                    ],
                    "group_operator": "and"
                },
                {
                    "api_name": "Created_Time",
                    "comparator": "greater_equal",
                    "value": "2019-10-14T15:30:00+05:30"
                }
            ],
            "group_operator": "or"
        }
    },
    "file_type": "ics"
}

Response object

The response object contains the following details:

status string

Specifies the status of the API call. Sample - "status": "success".

message string

Specifies the pre-defined comments for the job. Useful in case any errors occur. Sample - "message": "Added successfully."

details jsonobject

Contains the following details of the bulk read job.

operation string

Specifies the type of action the API completed. Sample - "operation" : "read”.

created_by jsonobject

Specifies the ID and Name of the user who initiated the bulk read job. Sample - "created_by": { "id": "1000000031045", "name": "Patricia Boyle" }.

created_time jsonobject

Specifies the created time of the bulk read job.

state string

Specifies the current status of the bulk read job. Example: "state": "ADDED" or "IN PROGRESS" or "COMPLETED".

id string

Specifies the unique identifier of the bulk read job. Use this ID to check the job status and download the result. Sample - "id": "1000010760002".

Sample response

Copied{
    "data": [
        {
            "status": "success",
            "code": "ADDED_SUCCESSFULLY",
            "message": "Added successfully.",
            "details": {
                "id": "554023000000568002",
                "operation": "read",
                "state": "ADDED",
                "created_by": {
                    "id": "554023000000235011",
                    "name": "Patricia Boyle"
                },
                "created_time": "2019-05-09T14:01:24+05:30"
            }
        }
    ],
    "info": {}
}
Notes
  • A maximum of two hundred thousand records can be exported in a single export job. i.e, "page" would be "1" and the records in the page would be "200,000". To know more about the Bulk API limits, go here.

  • The first 200,000 records matching the criteria are taken for export if the value of the "page" is "1".

  • To fetch data from parent modules, use the "."(dot) operator. For example, Contacts module has the default Account_Name lookup field. To fetch the name of the account that the contact is associated with, use Contacts.Account_Name.Account_Name.

  • Use only API names of fields and modules in the input.

  • If the "fields" attribute in the query JSON is left empty, all the fields available for the corresponding base module are listed in the CSV file. In case you need only specific fields, specify the field API names for export.

  • It is mandatory to specify the cvid if you want to export records under a custom view.

  • Along with cvid, you can also specify additional criteria. These criteria will be appended with the existing criteria for the custom/standard view.

For ICS file type
  • Exporting records in ICS format is supported only for the Meetings module.

  • You can export a maximum of 20,000 records from the Meetings module per batch.

  • The "fields" attribute is not supported when you want to export the meetings as an ICS file.

  • If you do not specify "file_type" as "ics", the records will be exported in the CSV format, by default.

  • If the value of more_records is "true" in the response of the Get Job Details API call, there are more records to be fetched.

Sample callback for job completed

Copied{
  "job_id": "554023000000568002",
  "operation": "read",
  "state": "COMPLETED",
  "query": {
    "module": "Contacts",
    "criteria": {
      "group": [
        {
          "api_name": "Owner.last_name",
          "comparator": "equal",
          "value": "Patricia Boyle"
        }
      ],
      "group_operator": "and"
    },
    "page": 1,
    "fields": [
      "Last_Name",
      "Owner",
      "Owner.last_name",
      "Company",
      "Email",
      "Mobile",
      "Created_Time"
    ],
    "cvid": "554023000000093005"
  },
  "result": {
    "page": 1,
    "count": 1588,
    "download_url": "/bigin/bulk/v2/read/554023000000568002/result",
    "per_page": 200000,
    "more_records": false
  }
}

Possible error codes

The response of this resource includes HTTP status and error codes.

The most common HTTP error codes that occur when you request access to this endpoint are given in the following:

  • MEDIA_TYPE_NOT_SUPPORTEDHTTP 415

    Media type is not supported.
    Resolution: You have not passed the 'Content-Type' header along with the request.

  • INVALID_URL_PATTERNHTTP 404

    Please check if the URL trying to access is a correct one
    Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: Client does not have ZohoBigin.bulk.read or ZohoBigin.modules.{module_name}.READ. Create a new client with valid scope. Refer to scope section above.

  • NO_PERMISSIONHTTP 403

    Permission denied to read
    Resolution: The user does not have permission to read records. Contact your system administrator.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in Server. Contact support team.

  • INVALID_REQUEST_METHODHTTP 400

    The http request method type is not a valid one
    Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above.

  • AUTHORIZATION_FAILEDHTTP 400

    User does not have sufficient privilege to read.
    Resolution: The user does not have the permission to read records. Contact your system administrator.

Sample callback for job failed

Copied{
  "job_id": "554023000000568002",
  "operation": "read",
  "state": "FAILURE",
  "query": {
    "module": "Contacts",
    "criteria": {
      "group": [
        {
          "api_name": "Owner.last_name",
          "comparator": "equal",
          "value": "Patricia Boyle"
        }
      ],
      "group_operator": "and"
    },
    "page": 1,
    "fields": [
      "Last_Name",
      "Owner",
      "Owner.last_name",
      "Email",
      "Mobile",
      "Created_Time"
    ],
    "cvid": "554023000000093005"
  },
    "result": {
    "error_message": {
      "message": "<error message>",
      "details": "<detailed messages>",
      "status": "error",
      "code": "<ERROR CODE>"
    }
  }
}