Data Store
Catalyst Data Store is a cloud-based relational database management system which stores the persistent data of your application in the form of tables.
Data Store APIs enable you to insert and manage records in the tables of your project's Data Store, obtain table and column details, and even perform bulk read and bulk write actions. However, you can create a table and its schema only from the Catalyst console.
Insert a New Row In a Table
Description
This API enables you to insert a new row of data or a record in a table in the Data Store, by referring to the table's unique ID or name.
You must pass the column names and their corresponding values for the record in a JSON format in the request as described below.
Note:
1. The table and the columns in it must already be created. You can create a table and the columns for it from the console.
2. You will be able to insert upto 5000 records in each table per project in the development environment. You can create upto 25,000 records overall in each project in the development environment. There are no upper limits for record creation in the production environment.
Request URL
https://api.catalyst.zoho.com/baas/v1/project/{project_id}/table/{tableIdentifier}/row
project_id - The unique ID of the project
tableIdentifier - The unique ID of the table or the table name
Request Headers
Authorization: Zoho-oauthtoken 1000.910***************************16.2f****************************57
Content-Type:application/json
Request Method
POST
Scope
scope=ZohoCatalyst.tables.rows.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 Format
You must send the column names and their corresponding values in a JSON format like this:
{
"column1_name": "column1_value",
"column2_name": "column2_value",
"column3_name": "column3_value",
.
.
}
where column_name is the name of a unique column in the table, and column_value is its corresponding value in the record.
Note: You must send at least one column name and value pair to insert in the record.
SDK documentation
Sample Request
curl -X POST \
https://api.catalyst.zoho.com/baas/v1/project/4000000006007/table/EmpDetails/row \
-H "Authorization: Zoho-oauthtoken 1000.910***************************16.2f****************************57"\
-H "Content-Type:application/json" \
-d '[
{
"Department_ID":"IT678",
"Department_Name":"Marketing",
"Employee_Name":"Robert Page"
}
]'
Sample Response
{
"status": "success",
"data": [
{
"CREATORID": 56000000002003,
"MODIFIEDTIME": "2019-03-13 18:20:49",
"Department_ID": "IT678"
"Department_Name": "Marketing"
"Employee_Name": "Robert Page",
"CREATEDTIME": "2019-03-13 18:20:49",
"ROWID": 56000000359193,
}
]
}
Sample SDK code
let database = Database() // create instance for Database
let mexRecord = CLRecord(table: "Restaurant") // create row
mexRecord["name"] = "Mexican Grill"
mexRecord["location"] = "San Jose, CA"
mexRecord["price_for_two"] = 200
database.save(mexRecord) { (result) in
switch result{
case .success(let record):
print("Record Saved \(record)")
case .error(let error):
print("Error in saving record \(error)")
}
}