Get Record by ID - v2.1
The functionality of this task can also be achieved using Get record - Detail View from API V2. But we suggest using API V2.1 for an updated experience.
Table of Contents
Updates in V2.1
1. New parameters have been added:
- field_config parameter key allows you to decide what fields of the records you want to be fetched. Possible values: quick_view, detail_view, custom, all.
- fields parameter key defines the fields that need to be fetched when the custom value is parsed for field_config.
2. Response structures have been revised:
- In API V2, the display_value of subform and lookup fields in the fetched response included space separated values. Along with this, in V2.1, they are included as key-value pairs in zc_display_value. This helps in efficient parsing of values further.
- In API V2, all multivalue fields had the response structure as space separated values in a string. The response value structures for different fields in API V2.1 have been updated:
- Multiselect, Checkbox: [list_value]
- Single select lookup, Integration: {map}
- Multiselect lookup: [{map1},{map2},{map3}...]
This helps in efficient parsing of values further.
Overview
This API fetches the data of a specific record from a report. This record will be identified by the record ID that you supply in the request URL.
Request Details
Request URL
https://<base_url>/creator/v2.1/data/<account_owner_name>/<app_link_name>/report/<report_link_name>/<record_id>
Request Method
GET
Header
Key | Value | Description |
Authorization | Zoho-oauthtoken 1000.8cb99dxxxxx xxxxxxxx9be93.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. |
accept |
| The format in which the API response is displayed. Default value: application/json |
OAuth Scope
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 target report |
Parameters
field_config string
(Optional)
detail_view fetches only the fields included in the detailed view layout. quick_view fetches only the fields included in the quick view layout. custom fetches only the specified fields. all fetches the fields included both in the detailed view and quick view layout.Default value: quick_view
Note:
- This API will not fetch the record displayed in the related data blocks of the detail view.
- If the key value is given as custom, the fields key should also be included in the header.
fields string
(Optional)
The required fields' link names 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.
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/3888833000000114027"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedtry
{
response = invokeUrl
[
url: "https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders/4445260000003624017?field_config=custom&fields=Single_Line%2CNumber"
type: GET
connection: "creatorconnection"
];
}
catch(e)
{
info "Exception while making the API request." ;
}
Copiedpackage org.example;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.json.JSONObject;
public class GetRecordById
{
public static void main(String[] args)
{
OkHttpClient client = new OkHttpClient();
HttpUrl.Builder urlBuilder = HttpUrl.parse("https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders/4445260000003624017").newBuilder()
.addQueryParameter("field_config","custom")
.addQueryParameter("fields","Single_Line,Number");
Request request = new Request.Builder()
.url(urlBuilder.toString())
.method("GET", null)
.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 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/4445260000003624017?field_config=custom&fields=Single_Line%2CNumber", {
method: "GET",
headers: api_headers
})
}
catch (exception) {
console.error(exception)
}
Copiedimport requests
api_parameters = {
"field_config": "custom",
"fields": "Single_Line,Number"
}
api_headers = {
"Authorization": "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
try:
response = requests.get("https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders/4445260000003624017", params=api_parameters ,headers=api_headers)
except:
print("Exception while making the API request.")
This sample request will fetch all the fields that's displayed in the quick view layout of the record with ID 3888833000000114027 from the All Orders report of the Zylker Store application.
Sample Request for Development/ Stage environments (for C6 users)
Copiedcurl "https://www.zohoapis.com/creator/v2.1/data/jason18/zylker-store/report/All_Orders/3888833000000114027"
-X GET
-H 'Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf'
-H 'environment: development'
-H 'demo_user_name: demouser_1'
Sample Response
Copied{
"code": 3000,
"data": {
"ID": "52129000008009043",
"Single_Line": "Warehouse",
"Email": "John@Lord.com",
"Currency": "1234723.90",
"Name": {
"zc_display_value": "John Lord",
"prefix": "",
"last_name": "Lord",
"suffix": "",
"first_name": "John"
},
"Address": {
"zc_display_value": "6, West Street, Phoenix, Phoenix, Arizona, 20532, USA",
"country": "USA",
"district_city": "Phoenix",
"address_line_1": "6, West Street",
"state_province": "Arizona",
"address_line_2": "Phoenix",
"postal_code": "20532"
},
"Image": "/api/v2.1/christinaclover/import/report/sample_report/52129000008009043/Image/download?filepath=1681379407888_John.jpeg",
"test_ss": {
"zc_display_value": "52129000008009170 - 13-Apr-2023 17:21:24 - christinaclover",
"Added_User": "christinaclover",
"ID": "52129000008009170",
"Added_Time": "13-Apr-2023 17:21:24"
},
"test_ss.Single_Line": "Portia",
"test_ss.Name": {
"zc_display_value": "Portia Lance",
"prefix": "",
"last_name": "Lance",
"suffix": "",
"first_name": "Portia"
},
"test_ms": [
{
"zc_display_value": "52129000008009051 - christinaclover - John - 13-Apr-2023 16:59:29",
"Modified_Time": "13-Apr-2023 16:59:29",
"Added_User": "christinaclover",
"ID": "52129000008009051",
"Name.first_name": "John"
},
{
"zc_display_value": "52129000008009170 - christinaclover - Portia - 13-Apr-2023 18:03:05",
"Modified_Time": "13-Apr-2023 18:03:05",
"Added_User": "christinaclover",
"ID": "52129000008009170",
"Name.first_name": "Portia"
}
],
"test_ms.Single_Line": [
"test",
"Portia"
],
"test_ms.Name": [
{
"zc_display_value": "John Lord",
"prefix": "",
"last_name": "Lord",
"suffix": "",
"first_name": "John"
},
{
"zc_display_value": "Portia Lance",
"prefix": "",
"last_name": "Lance",
"suffix": "",
"first_name": "Portia"
}
],
"SubForm": [
{
"zc_display_value": "John Lord 220B, Baker Street, London, London, 13455, United Kingdom 10-Apr-2023 52129000008009051 52129000008009051, 52129000008009084",
"Date_field": "10-Apr-2023",
"Address": {
"zc_display_value": "220B, Baker Street, London, London, 13455, United Kingdom",
"country": "United Kingdom",
"district_city": "London",
"address_line_1": "220B, Baker Street",
"state_province": "London",
"address_line_2": "",
"postal_code": "13455"
},
"test": {
"zc_display_value": "52129000008009051",
"ID": "52129000008009051"
},
"test_ms": [
{
"zc_display_value": "52129000008009051",
"ID": "52129000008009051"
},
{
"zc_display_value": "52129000008009084",
"ID": "52129000008009084"
}
],
"ID": "52129000008009023",
"Name": {
"zc_display_value": "John Lord",
"last_name": "Lord",
"first_name": "John"
}
},
{
"zc_display_value": " ",
"Date_field": "",
"Address": {
"zc_display_value": "",
"country": "",
"district_city": "",
"address_line_1": "",
"state_province": "",
"address_line_2": "",
"postal_code": ""
},
"test": {},
"test_ms": [],
"ID": "52129000008009029"
}
],
"Users_MS": [
"christinaclover",
"manish.koothrapalli"
]
}
}