Fetch record by ID
Table of Contents
Overview
This task is used to fetch a record from Zoho Books using the record ID.
This task is based on Zoho Books API -> <Module> -> Get <ModuleName>.
Syntax
<variable> = zoho.books.getRecordsByID(<module_name>, <org_ID>, <record_id>, <connection>);
Params | Data Type | Description |
<variable> | KEY-VALUE | Variable to hold the response returned by Zoho Books. |
<module_name> | TEXT | specifies the Zoho Books' module from which the record will be fetched. The applicable module names can be found in the "Request Example" section in Zoho Books API -> <Module> -> Get <ModuleName> |
<org_ID> | TEXT | specifies the organization ID of the organization from which the record will be fetched. |
<record_ID> | TEXT | ID of the record which will be fetched. Learn how to fetch the ID of a record after creating it or fetching it. |
<connection>
| TEXT | is the name of the Zoho Books connection Note:
|
Example
The following script fetches a record from the Zoho Books module - Contacts module in Zoho Books based on the specified record id.
response = zoho.books.getRecordsById("Contacts", "5379XXXX", "XXXXXXXXXXXX92275", "books_connection");
where,
response
"Contacts"
"5379XXXX"
"XXXXXXXXXXXX92275"
"books_connection"
Sample Response
- The success response returned is of the following format:
{
"code":0,
"contact":{
"is_crm_customer":false,
"addresses":[],
"notes":"",
"documents":[],
"owner_id":"",
"is_linked_with_zohocrm":false,
"is_client_review_settings_enabled":false,
"pan_no":"",
"billing_address":{
"zip":"",
"country":"",
"address":"",
"city":"",
"phone":"",
"address_id":"XXXXXXXXXXXX92277",
"attention":"",
"street2":"",
"state":"",
"state_code":"",
"fax":""
},
"default_templates":{
"invoice_email_template_id":"",
"salesorder_email_template_id":"",
"salesorder_template_id":"",
"creditnote_email_template_id":"",
"creditnote_template_name":"",
"paymentthankyou_email_template_name":"",
"estimate_template_id":"",
"paymentthankyou_template_id":"",
"salesorder_email_template_name":"",
"salesorder_template_name":"",
"invoice_email_template_name":"",
"creditnote_email_template_name":"",
"invoice_template_id":"",
"paymentthankyou_email_template_id":"",
"invoice_template_name":"",
"estimate_template_name":"",
"estimate_email_template_id":"",
"creditnote_template_id":"",
"paymentthankyou_template_name":"",
"estimate_email_template_name":""
},
"source":"api",
"outstanding_receivable_amount_bcy":0.0,
"language_code":"",
"twitter":"",
"zcrm_contact_id":"",
"unused_credits_receivable_amount_bcy":100.0,
"gst_no":"",
"tax_reg_no":"",
"contact_category":"",
"associated_with_square":false,
"place_of_contact":"",
"contact_persons":[],
"pricebook_id":"",
"outstanding_receivable_amount":0.0,
"gst_treatment":"",
"created_time":"2017-02-24T12:31:14+0530",
"owner_name":"",
"zcrm_account_id":"",
"custom_fields":[],
"vat_reg_no":"",
"unused_credits_receivable_amount":100.0,
"has_transaction":true,
"outstanding_payable_amount_bcy":0.0,
"tax_id":"XXXXXXXXXXXX10079",
"pricebook_name":"",
"price_precision":2,
"tags":[],
"primary_contact_id":"",
"country_code":"",
"checks":[],
"unused_credits_payable_amount_bcy":0.0,
"company_name":"",
"tax_treatment":"",
"crm_owner_id":"",
"status":"active",
"cards":[],
"contact_id":"XXXXXXXXXXXX92275",
"payment_terms":0,
"currency_code":"INR",
"outstanding_payable_amount":0.0,
"contact_type":"customer",
"unused_credits_payable_amount":0.0,
"shipping_address":{
"zip":"",
"country":"",
"address":"",
"city":"",
"phone":"",
"address_id":"XXXXXXXXXXXX92279",
"attention":"",
"street2":"",
"state":"",
"state_code":"",
"fax":""
},
"contact_name":"updated24-Feb-2017 123114",
"website":"",
"is_client_review_asked":false,
"last_modified_time":"2017-02-24T12:31:18+0530",
"language_code_formatted":"",
"currency_symbol":"Rs.",
"ach_supported":false,
"facebook":"",
"tax_name":"GST12",
"vendor_portal_url":"",
"unused_retainer_payments":0.0,
"contact_salutation":"",
"tax_percentage":12.0,
"bank_accounts":[],
"currency_id":"XXXXXXXXXXXX00099",
"is_taxable":true,
"payment_terms_label":"Due On Receipt",
"payment_reminder_enabled":true
},
"instrumentation":{
"query_execution_time":359,
"response_write_time":260,
"page_context_write_time":0,
"request_handling_time":191
},
"message":"success"
} - The failure response returned due to incorrect record id is of the following format:{
"code":1002,
"message":"Contact does not exist."
} - The failure response returned due to incorrect org id is of the following format:{
"code":6041,
"message": "This user is not associated with the CompanyID/CompanyName:537XX."
}
Related Links
- Zoho Books API -> <Module> -> Get <ModuleName>
- Common error codes can be viewed here