Update Records - v2.1
Updates in V2.1
1. New parameters have been added:
- In V2.1, by default, all associated workflows will get triggered. skip_workflow parameter key allows the restriction of schedules and form workflows. In API V2, this provision of skipping certain workflows is not possible.
Table of Contents
Overview
This API updates the records displayed in a report of a Zoho Creator application. A maximum of 200 records can be updated per request. Updating records is subject to data validation. Learn more
Request Details
Request URL
https://<base_url>/creator/v2.1/data/<account_owner_name>/<app_link_name>/report/<report_link_name>
Request method
PATCH
Header
Key | Value | Description |
Authorization | Zoho-oauthtoken 1000.8cb99dxxxx xxxxxxxxx9be93.9b 8xxxxxxxxxxxxxxxf | An authentication token (authtoken) allows users to access apps and APIs without having to enter their login credentials each time. |
environment | development/stage | Refers to the environment stage. |
demo_user_name | demouser_1, demouser_2, demouser_3.. | Demo users in your Creator app can be appended along with the environment. |
OAuth scope
scope=ZohoCreator.report.UPDATE
where,
base_url | the base URL of your Creator account For example, it's www.zohoapis.com if your account belongs to Zoho's US DC, and is www.zohoapis.eu if it belongs to Zoho's EU DC. |
account_owner_name | the username of the Creator account's owner |
app_link_name | the link name of the target application |
report_link_name | the link name of the report that displays the records you want to update |
Body
- criteria string
(Mandatory) The criteria using which you want to filter the target report. If you're looking to update all matching records, you'll have to include "criteria": "ID!=0" or "criteria": "ID!=null" in your request. Criteria is mandated to prevent you from accidentally updating all matching records (when less than 200). The sample input on the right sports a criteria that'll filter for records where the Single_Line field contains the value "Single Line of Text".
- skip_workflow list
(Optional) Prevents the associated workflows from being executed while updating a record. You can choose to skip form workflows and/or schedules. When more than one type of workflow is mentioned, the parameter values should be supplied as comma separated values in a list.
Possible values: form_workflow, schedules, allNote: By default:
- If this parameter is not supplied, all associated workflows will be triggered.
- Blueprints and approvals will be triggered while records are updated, and cannot be skipped.
Sample value for the parameter "skip_workflow" Description "skip_workflow" : ["schedule","form_workflow"] Prevents the associated schedules and form workflows from being triggered when the record is updated using API "skip_workflow" : ["schedules"] Prevents the associated schedules when the record is updated using API "skip_workflow" : ["all"] Prevents the associated schedules and form workflows from being triggered when the record is updated using API
Parameters
- process_until_limit string
A maximum of 200 records can be updated per request. When the number of matching records exceeds 200, your request will fail unless it includes this parameter. Including process_until_limit=true in your request ensures it updates the first 200 records and returns the more_records key in the response. You'll have to loop your API requests until the more_records key in the response is returned as false.
Setting Field Values
- The Updates Records API allows you to set values for all field types except add notes, formula, auto number, section, file upload, audio, video, signature, prediction, sentiment analysis, keyword extraction, OCR, and object detection.
- Fields are identified by their link name.
- Text fields, except multi line and rich text, can accept up to 255 characters or the value set for their max characters property.
- The value for numeric fields is subject to their max digits and decimal places properties.
- When the value for the phone field includes the international calling code, the corresponding country will be set in the field subject to its Country code options property.
- The multi line and rich text fields can accept up to 64 KB of text.
- The value for the drop down and radio fields must be one of their predefined choices. When their Allow Other Choices property is enabled, these fields will accept a custom text that doesn't exceed 255 characters.
- The value for the multi select and checkbox fields must conform to their predefined choices.
- The value for the multi select, checkbox, and lookup (multi-select) fields must be comma-separated.
- The value for the lookup field must be a valid record ID.
- When configured to accept a URL input, the image field will accept the URL of an image. You may also use the upload file API to upload an image.
- You must use the upload file API to add/update the file upload, audio, video, and signature fields.
Data Validations in Creator
The target records will be updated provided your data passes the data validations set for the form, which include:
- Mandatory: When enabled, this field property ensures that input is set for the field.
- No duplicate values: When enabled, this field property ensures that the input value is unique in that field across the records, i.e., the input value is not already present in any of the existing records.
- Max characters: This field property applies to text fields. It ensures that the input value does not exceed the number of preset characters. By default, this is set to 255 for text fields except multi line and rich text, which accept up to 64 KB of text.
- Max digits and decimal places: These field properties apply to numeric fields. They ensure that the input value does not exceed the number of preset digits and decimal places, respectively.
- Form availability: This property restricts the target form's availability to the predefined duration.
- Custom validations configured for the target form.
Defining the Search Criteria
- The search criteria is a combination of one or more expressions. An expression is defined using a field, operator, and value.
- An expression can use all field types except section and add notes. The field's data type dictates the operator that can be used and the format in which the value is to be given.
- You can use logical operators&& (AND), || (OR), and ! (NOT) to link the expressions in your criteria. These operators are subject to precedence, which you can manage using parentheses ().
- Values for STRING type fields, such as single line, email, and phone, must be enclosed in double-quotes, and the double-quotes must be escaped.
- Values for the time, date, and date-time fields must adhere to the application's date and time formats and must be enclosed in single-quotes.
- The record ID must be passed when you want to filter the records using the lookup field.
- When using the multi select, checkbox or multi-select lookup fields, you can specify only one value per expression.
Sample criteria in the JSON | Description |
---|---|
"criteria": "Status==\"Closed\"" | To fetch the records where the Status (a drop down or radio field) is "Closed" |
"criteria": "Status!=\"Open\"" | To fetch the records where the Status (a drop down or radio field) is not "Open" |
"criteria": "Email.endswith(\"zylker.com\")" | To fetch the records where the Email (an email field) ends with "zylker.com" |
"criteria": "Email.startswith(\"ja\")" | To fetch the records where the Email (an email field) starts with "ja", such as "jason@zylker.com" and "janine@zylker.com" |
"criteria": "Feedback.contains(\"it's awful\")" | To fetch the records where the Feedback (a multi line or rich text field) contains "it's awful" |
"criteria": "Age!=28" | To fetch the records where the Age (a multi line or rich text field) is not 28 |
"criteria": "Total=250.43" | To fetch the records where the Total (a decimal or currency field) is 250.43 |
"criteria": "Total>=250.43" | To fetch the records where the Total (a decimal or currency field) is greater than or equal to 250.43 |
"criteria": "Appointment_Date==\"14-Apr-2020\"" | To fetch the records where the appointment date (a date field) is 14-Apr-2020 (as per the application's date format) |
"criteria": "Expedited_Delivery=false" | To fetch the records where the Expedited_Delivery (a decision box field) is false |
"criteria": "Hobbies.contains(\"Hiking\")" | To fetch the records where the Hobbies (a multi select or checkbox field) includes "Hiking" |
"criteria": "Status==\"Open\" || Status==\"In-progress\"" | To fetch the records where the Status (a drop down or radio field) is either "Open" or "In-progress" |
"criteria": "Status==\"Closed\" && Email.endswith(\"zylker.com\")" | To fetch the records where the Status (a drop down or radio field) is "Closed" and the Email (an email field) ends with "zylker.com" |
Understanding the Response
The success or failure of the API will be conveyed in its response. The response of the Update Records API includes the following keys:
- result
This key will contain the details about the records updated by this API.
- code
At the overall request's level, this key denotes its success or failure. Inside the "result" key, this key denotes the success or failure of the updated operation. Refer to this page for the complete list of codes and messages.
- message
- When the API request includes "message": true, the response will contain "message":"Data Updated Successfully" or the message that's configured as part of a show message workflow action
- When the API request includes "message": false or does not include this the message key, the response will contain "message":"Data Updated Successfully"
- data
This key will list the ID of the records created. It will also list other field values from the updated records when you include the fields inside the "fields" key of your API request. Refer to the sample input and sample response sections on the right.
- tasks
When the API request includes this key with value true, the response will return the details of the form, report, page, or URL to which the target form is configured to redirect to upon successful form submission. Redirection can be set up using a redirection workflow action. The "type" key will contain the type of window in which the target URL is to open (same window, new window, or parent window). The "url" key will contain one of the following, for example:
- #Form:<form_link_name>
- #Report:<report_link_name>
- #Page:<page_link_name>
- https://www.zylker.com
Possible Errors
Refer to this page for the list of error codes and messages.
Sample Request for Production environment (for C6 users)
Copiedcurl "https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders"
-X PATCH
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedpayload = Map();
payload.put("criteria","Single_Line == \"Single Line of Text\"");
recordMap = Map();
recordMap.put("Single_Line","Single Line of Text");
recordMap.put("Number","12345");
nameMap = Map();
nameMap.put("prefix","Mr.");
nameMap.put("first_name","Jason");
nameMap.put("last_name","Bowley");
nameMap.put("suffix","Jr");
recordMap.put("Name", nameMap);
recordMap.put("Dropdown","Choice 3");
multiSelectList = List();
multiSelectList.add("Choice 1");
multiSelectList.add("Choice 2");
recordMap.put("Multi_Select", multiSelectList);
recordMap.put("Decision_box",true);
urlMap = Map();
urlMap.put("value","Zylker");
urlMap.put("url","www.zylker.com");
urlMap.put("title","Zylker - Title");
recordMap.put("Url",urlMap);
recordMap.put("Lookup","4445260000003610007");
subFormRecord1 = Map();
subFormRecord1.put("Email","barry@zylker.com");
subFormRecord1.put("Date_Time","10-Jan-2020 22:12:10");
subFormRecord2 = Map();
subFormRecord2.put("Email","harry@zylker.com");
subFormRecord2.put("Date_Time","11-Jan-2020 22:12:10");
subformList = List();
subformList.add(subFormRecord1);
subformList.add(subFormRecord2);
recordMap.put("SubForm",subformList);
payload.put("data",recordMap);
skipWorkflowList = List();
skipWorkflowList.add("form_workflow");
payload.put("skip_workflow",skipWorkflowList);
resultMap = Map();
fieldsList = List();
fieldsList.add("Single_Line");
fieldsList.add("Number");
resultMap.put("fields",fieldsList);
resultMap.put("message",true);
resultMap.put("tasks",true);
payload.put("result",resultMap);
try
{
response = invokeUrl
[
url: "https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders?process_until_limit=true"
type: PATCH
parameters: payload.toString()
connection: "creatorconnection"
];
}
catch(e)
{
info "Exception while making the API request." ;
}
Copiedpackage org.example;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import org.json.JSONArray;
import org.json.JSONObject;
public class UpdateRecords
{
public static void main(String[] args)
{
JSONObject payload = new JSONObject();
payload.put("criteria","Single_Line == \"Single Line of Text\"");
JSONObject recordObj = new JSONObject();
recordObj.put("Single_Line","Single Line of Text");
recordObj.put("Number","12345");
JSONObject nameObj = new JSONObject();
nameObj.put("prefix","Mr.");
nameObj.put("first_name","Jason");
nameObj.put("last_name","Bowley");
nameObj.put("suffix","Jr");
recordObj.put("Name", nameObj);
recordObj.put("Dropdown","Choice 3");
JSONArray multiSelectArr = new JSONArray();
multiSelectArr.put("Choice 1");
multiSelectArr.put("Choice 2");
recordObj.put("Multi_Select", multiSelectArr);
recordObj.put("Decision_box",true);
JSONObject urlObj = new JSONObject();
urlObj.put("value","Zylker");
urlObj.put("url","www.zylker.com");
urlObj.put("title","Zylker - Title");
recordObj.put("Url",urlObj);
recordObj.put("Lookup","4445260000003610007");
JSONObject subFormRecord1 = new JSONObject();
subFormRecord1.put("Email","barry@zylker.com");
subFormRecord1.put("Date_Time","10-Jan-2020 22:12:10");
JSONObject subFormRecord2 = new JSONObject();
subFormRecord2.put("Email","harry@zylker.com");
subFormRecord2.put("Date_Time","11-Jan-2020 22:12:10");
JSONArray subformArr = new JSONArray();
subformArr.put(subFormRecord1);
subformArr.put(subFormRecord2);
recordObj.put("SubForm",subformArr);
payload.put("data",recordObj);
JSONArray skipWorkflowArr = new JSONArray();
skipWorkflowArr.put("form_workflow");
payload.put("skip_workflow",skipWorkflowArr);
JSONObject resultObj = new JSONObject();
JSONArray fieldsArr = new JSONArray();
fieldsArr.put("Single_Line");
fieldsArr.put("Number");
resultObj.put("fields",fieldsArr);
resultObj.put("message",true);
resultObj.put("tasks",true);
payload.put("result",resultObj);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, payload.toString());
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders").newBuilder()
.addQueryParameter("process_until_limit","true");
Request request = new Request.Builder()
.url(urlBuilder.toString())
.method("PATCH", body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf")
.build();
try
{
JSONObject response = new JSONObject(client.newCall(request).execute().body().string());
}
catch (Exception e)
{
System.out.println("Exception while making the API request.");
}
}
}
Copiedlet payload = {
"criteria": "Single_Line == \"Single Line of Text\"",
"data":
{
"Single_Line": "Single Line of Text",
"Number": "12345",
"Name": {
"prefix": "Mr.",
"last_name": "Bowley",
"suffix": "Jr",
"first_name": "Jason"
},
"Dropdown": "Choice 3",
"Multi_Select": [
"Choice 1",
"Choice 2"
],
"Decision_box": true,
"Url": {
"title": "Zylker - Title",
"value": "Zylker",
"url": "www.zylker.com"
},
"Lookup": "4445260000003610007",
"SubForm": [
{
"Date_Time": "10-Jan-2020 22:12:10",
"Email": "barry@zylker.com"
},
{
"Date_Time": "11-Jan-2020 22:12:10",
"Email": "harry@zylker.com"
}
]
},
"skip_workflow": [
"form_workflow"
],
"result": {
"fields": [
"Single_Line",
"Number"
],
"message": true,
"tasks": true
}
}
let api_headers = {
"Authorization": "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
try {
let response = fetch("https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders?process_until_limit=true", {
method: "PATCH",
headers: api_headers,
body: JSON.stringify(payload)
})
}
catch (exception) {
console.error(exception)
}
Copiedimport requests
payload = {
"criteria": "Single_Line == \"Single Line of Text\"",
"data":
{
"Single_Line": "Single Line of Text",
"Number": "12345",
"Name": {
"prefix": "Mr.",
"last_name": "Bowley",
"suffix": "Jr",
"first_name": "Jason"
},
"Dropdown": "Choice 3",
"Multi_Select": [
"Choice 1",
"Choice 2"
],
"Decision_box": True,
"Url": {
"title": "Zylker - Title",
"value": "Zylker",
"url": "www.zylker.com"
},
"Lookup": "4445260000003610007",
"SubForm": [
{
"Date_Time": "10-Jan-2020 22:12:10",
"Email": "barry@zylker.com"
},
{
"Date_Time": "11-Jan-2020 22:12:10",
"Email": "harry@zylker.com"
}
]
},
"skip_workflow": [
"form_workflow"
],
"result": {
"fields": [
"Single_Line",
"Number"
],
"message": True,
"tasks": True
}
}
api_parameters = {
"process_until_limit": True
}
api_headers = {
"Authorization": "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
try:
response = requests.patch("https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders", params=api_parameters, headers=api_headers, data=str(payload))
except:
print("Exception while making the API request.")
This sample request will update the records displayed in the All Orders report of the Zylker Store application. The sample input below shows how to include a criteria in this request.
Sample Request for Development/ Stage environments (for C6 users)
Copiedcurl "https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders"
-X PATCH
-H 'Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf'
-H 'environment: development'
-H 'demo_user_name: demouser_1'
Sample Input: To search using a text field and update all field types
Copied{
"criteria": "(Single_Line.contains(\"Single Line of Text\"))",
"data": {
"Email": "jason@zylker.com",
"Phone_Number": "+16103948336",
"Name": {
"prefix": "Mr.",
"first_name": "Jason",
"last_name": "Bowley",
"suffix": "Jr"
},
"Address": {
"address_line_1": "4154 High Meadow Lane",
"address_line_2": "",
"district_city": "Scranton",
"state_province": "PA",
"postal_Code": "18503",
"country": "United States"
},
"Single_Line": "Single Line of Text",
"Multi_Line": "Multiple\nLines\nof text",
"Rich_Text": "Rich Text",
"Dropdown": "Choice 1",
"Radio": "Choice 2",
"Multi_Select": [
"Choice 1",
"Choice 3"
],
"Checkbox": [
"Choice 2",
"Choice 3"
],
"Decision_box": "true",
"Number": "1000",
"Decimal": "1000.03",
"Percent": "86.45",
"Currency": "789.32",
"Date_field": "10-Jan-2020",
"Time_field": "22:12:10",
"Date_Time": "10-Jan-2020 22:12:10",
"Url": {
"value": "Zylker",
"url": "www.zylker.com",
"title": "Zylker - Title"
},
"Lookup": "3888833000000114027",
"SubForm": [
{
"Name": {
"first_name": "Barry",
"last_name": "McLead"
},
"Email": "barry@zylker.com",
"Single_Line": "SingleLine of Text - Subform record 1"
}
]
},
"skip_workflow": ["form_workflow"],
"result": {
"fields": [
"Single_Line",
"Number"
],
"message": true,
"tasks": true
}
}
Sample Response
Copied{
"result": [
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000114023"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
},
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000114047"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
},
{
"code": 3000,
"data": {
"Number": "12345",
"Single_Line": "Single Line of Text",
"ID": "3888833000000118019"
},
"message": "Data Updated Successfully!",
"tasks": {
"openurl": {
"type": "Same window",
"url": "http://www.zylker.com"
}
}
}
],
"code": 3000
}