Loading...

ZCQL

ZCQL is Catalyst’s own query language that enables you to perform data retrieval, insertion, updating, and deletion operations on the tables in the Catalyst Data Store.

You can execute a variety of DML queries using ZCQL to obtain or manipulate data, and use various clauses and statements such as the SQL Join clauses, Groupby and OrderBy statements, and built-in SQL functions.

Execute a ZCQL Query

Description

This API enables you to execute a ZCQL query to retrieve, insert, update, or delete data from the tables in the Data Store. You can execute this API by passing a ZCQL query in the JSON request, as shown in the sample requests.

Note: The API request format is the same for all ZCQL query execution operations.

Request Details

Request URL

POST

{api-domain}/baas/v1/project/{project_id}/query

copy

api-domain
URL
The DC-specific domain to access Catalyst API

project_id
Numerical
The unique ID of the project

Request Headers

Authorization: Zoho-oauthtoken {oauth_token}
Content-Type: application/json

Optional Headers

CATALYST-ORG: {org_id}

Environment: Development

Scope

ZohoCatalyst.zcql.CREATE

Note: This operation can also be executed with Catalyst user authentication permissions using Catalyst SDKs. Refer to the Catalyst API Prerequisites section for details.

Request JSON Properties

query string
mandatory
The ZCQL query to be executed

Response Details

Data Retrieval Operations: The API returns the records that were fetched as a result of the query execution as the response.

Data Insertion and Updating Operations: The API returns the records that were inserted or updated through the query as the response.

Data Deletion Operations: The API returns the deleted row count.

Sample Request: Data Retrieval
copy

curl -X POST
https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query
-H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57”
-H “Content-Type: application/json”
-d ‘{ “query”:“SELECT EmpID, EmpName, Department, Address from EmpDetails ORDER BY EmpID ASC LIMIT 1000,5” }’

View more
Sample Response: Data Retrieval
copy
{
"status": "success",
"data": [
    {
        "EmpDetails": {
            "CREATORID": "3376000000002003",
            "MODIFIEDTIME": "2023-06-05 15:09:33:881",
            "CREATEDTIME": "2023-06-05 15:09:33:881",
            "ROWID": "3376000001924975",
            "EmpID": "1001",
            "EmpName": "Allison Powell",
            "Department":"Marketing",
            "Address": "13, Winter Avenue, Philadelphia, PY"
        }
    },
    {
        "EmpDetails": {
            "CREATORID": "3376000000002003",
            "MODIFIEDTIME": "2023-06-05 15:09:33:881",
            "CREATEDTIME": "2023-06-05 15:09:33:881",
            "ROWID": "3376000001927682",
            "EmpID": "1002",
            "EmpName": "James Cortez",
            "Department":"HR",
            "Address": "25, Blossom Street, Austin, TX"
        }
    },
    {
        "EmpDetails": {
            "CREATORID": "3376000000002003",
            "MODIFIEDTIME": "2023-06-02 21:04:11:111",
            "CREATEDTIME": "2023-06-02 15:05:21:001",
            "ROWID": "3376000001224112",
            "EmpID": "1003",
            "EmpName": "Han Chan",
            "Department":"Sales",
            "Address": "112, St.Patrick's Road, Louisville, KY"
        }
    },
    {
        "EmpDetails": {
            "CREATORID": "337600000003111",
            "MODIFIEDTIME": "2023-06-02 21:04:11:111",
            "CREATEDTIME": "2023-06-02 15:05:21:001",
            "ROWID": "3376000001242012",
            "EmpID": "1004",
            "EmpName": "Rubella Miguel",
            "Department":"Accounts",
            "Address": "333, Marine Bay, Salt Lake City, UT"
        }
    },
    {
        "EmpDetails": {
            "CREATORID": "3376000000115254",
            "MODIFIEDTIME": "2023-04-12 21:04:10:521",
            "CREATEDTIME": "2023-06-11 15:05:02:541",
            "ROWID": "3376000001241341",
            "EmpID": "1005",
            "EmpName": "Ronwick Boseman",
            "Department":"Support",
            "Address": "61, Gringott's Avenue, Herfordshire, CO"
        }
    }
]

}

View more
Sample Request: Data Insertion
copy

curl -X POST
https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query
-H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57
-H “Content-Type: application/json”
-d ‘{ “query”:“INSERT INTO EmpDetails VALUES (1007,‘Randy Marsh’,‘Sales’,‘42, Tenth Street, Jacksonville, FL’, ‘14 MAR 2017’)” }’

View more
Sample Response: Data Insertion
copy
{
"status": "success",
"data": [
  {
    "EmpDetails": {
      "CREATORID": "3813000000002003",
      "EmpID": "1007",
      "EmpName": "Randy Marsh",
      "Department":"Sales",
      "Address": "42, Tenth Street, Jacksonville, FL",
      "DOJ": "14 MAR 2017",
      "MODIFIEDTIME": "2021-08-04 09:10:14:752",
      "CREATEDTIME": "2021-08-04 09:10:14:752",
      "ROWID": "3813000000214001"
    }
  }
]

}

View more
Sample Request: Data Updating
copy

curl -X POST
https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query
-H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57
-H “Content-Type: application/json”
-d ‘{ “query”:“UPDATE EmpDetails SET Department=‘Operations’ WHERE EmpID=1007” }’

View more
Sample Response: Data Updating
copy
{
"status": "success",
"data": [
  {
    "EmpDetails": {
      "CREATORID": "3813000000002003",
      "EmpID": "1007",
      "EmpName": "Randy Marsh",
      "Department":"Operations",
      "Address": "42, Tenth Street, Jacksonville, FL",
      "DOJ": "14 MAR 2017",
      "MODIFIEDTIME": "2021-08-04 09:11:54:318",
      "CREATEDTIME": "2021-08-04 09:10:14:752",
      "ROWID": "3813000000214001"
    }
  }
]

}

View more
Sample Request: Data Deletion
copy

curl -X POST
https://api.catalyst.zoho.com/baas/v1/project/4000000006007/query
-H “Authorization: Zoho-oauthtoken 1000.910*************************16.2f*************************57
-H “Content-Type: application/json”
-d ‘{ “query”:“DELETE FROM EmpDetails WHERE EmpID=1007” }’

View more
Sample Response: Data Deletion
copy
{
"status": "success",
"data": [
  {
    "EmpDetails": {
      "DELETED_ROWS_COUNT": 1
    }
  }
]

}

View more