Purchase Order
A purchase order is an official document that a buyer issues to a seller, indicating relevant information about what they want to buy, the quantity, the price agreed for that particular product or service.
Attribute
uk
. If the vendor is in an EU country & VAT registered, you are resides in Northen Ireland and purchasing Goods then his VAT treatment is eu_vat_registered
and if he resides outside the UK then his VAT treatment is overseas
(For Pre Brexit, this can be split as eu_vat_registered
, eu_vat_not_registered
and non_eu
). business_gst
, business_none
, overseas
, consumer
.vat_registered
,vat_not_registered
,gcc_vat_not_registered
,gcc_vat_registered
,non_gcc
.dz_vat_registered
and dz_vat_not_registered
are supported only for UAE.home_country_mexico
,border_region_mexico
,non_mexico
supported only for MX.For Kenya Edition:
vat_registered
,vat_not_registered
,non_kenya
(A business that is located outside Kenya).For SouthAfrica Edition:
vat_registered
, vat_not_registered
, overseas
(A business that is located outside SouthAfrica).place of contact
given for the contact will be taken)place of contact
given for the contact will be taken)Supported codes for UAE emirates are : Abu Dhabi -
AB
,Ajman - AJ
,Dubai - DU
,Fujairah - FU
,Ras al-Khaimah - RA
,Sharjah - SH
,Umm al-Quwain - UM
.Supported codes for the GCC countries are : United Arab Emirates -
AE
,Saudi Arabia - SA
,Bahrain - BH
,Kuwait - KW
,Oman - OM
,Qatar - QA
.goods
, digital_service
and service
.uae_same_tax_group
, uae_reimbursed_expense
and uae_others
. Supported values for Bahrain are bahrain_same_tax_group
, bahrain_transfer_of_concern
, bahrain_disbursement
, bahrain_head_to_branch_transaction
, bahrain_warranty_repair_services
and bahrain_others
. Supported values for KSA are ksa_reimbursed_expense
.{
"purchaseorder_id": "460000000062001",
"documents": [
{
"document_id": 0,
"file_name": "string"
}
],
"vat_treatment": "string",
"gst_no": "22AAAAA0000A1Z5",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"is_pre_gst": false,
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"pricebook_name": "",
"is_reverse_charge_applied": false,
"purchaseorder_number": "PO-00001",
"date": "2014-02-10",
"expected_delivery_date": "string",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"reference_number": "ER/0034",
"status": "draft",
"vendor_id": "460000000026049",
"vendor_name": "string",
"crm_owner_id": "string",
"contact_persons": [
"460000000026051"
],
"currency_id": "460000000000099",
"currency_code": "INR",
"currency_symbol": "string",
"exchange_rate": 1,
"delivery_date": "2014-02-10",
"is_emailed": false,
"is_inclusive_tax": false,
"line_items": [
{
"item_id": "460000000027009",
"line_item_id": "460000000074009",
"sku": "string",
"warehouse_id": 460000000026051,
"warehouse_name": "string",
"product_type": "string",
"reverse_charge_tax_id": 460000000026068,
"reverse_charge_tax_name": "inter",
"reverse_charge_tax_percentage": 10,
"reverse_charge_tax_amount": 100,
"account_id": "460000000074003",
"account_name": "Other Expenses",
"name": "Hard Drive",
"description": "string",
"item_order": 0,
"bcy_rate": 40,
"unit": "Nos",
"rate": 112,
"quantity": 1,
"item_total": 40,
"item_total_inclusive_of_tax": 40,
"tax_exemption_id": "string",
"tax_exemption_code": "string",
"tax_id": "string",
"tax_treatment_code": "uae_others",
"tax_name": "string",
"tax_type": "tax",
"tax_percentage": 0,
"hsn_or_sac": "string",
"acquisition_vat_id": "string",
"acquisition_vat_name": "string",
"acquisition_vat_percentage": "string",
"acquisition_vat_amount": "string",
"reverse_charge_vat_id": "string",
"reverse_charge_vat_name": "string",
"reverse_charge_vat_percentage": "string",
"reverse_charge_vat_amount": "string",
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"item_custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"project_id": 90300000087378,
"project_name": "Sample Project"
}
],
"sub_total": 40,
"tax_total": 0,
"total": 40,
"taxes": [
"string"
],
"acquisition_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"acquisition_vat_total": 0.1,
"reverse_charge_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"reverse_charge_vat_total": 0.1,
"billing_address": {
"address": "string",
"street2": "McMillan Avenue",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string"
},
"notes": "Please deliver as soon as possible.",
"terms": "Thanks for your business.",
"ship_via": "string",
"ship_via_id": "string",
"attention": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"delivery_address": {
"zip": "string",
"is_verifiable": true,
"state": "string",
"address1": "string",
"address2": "string",
"is_valid": "string",
"city": "string",
"country": "string",
"address": "string",
"email": "peterparker@bowmanfurniture.com",
"is_primary": "string",
"organization_address_id": "string",
"phone": "+1-925-929-7211",
"is_verified": false
},
"price_precision": 2,
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"attachment_name": "7.png",
"can_send_in_mail": false,
"template_id": "460000000011003",
"template_name": "Standard Template",
"page_width": "8.27in",
"page_height": "11.69in",
"orientation": "portrait",
"template_type": "standard",
"created_time": "2014-02-10T15:26:26+0530",
"created_by_id": "460000000053001",
"last_modified_time": "2014-02-10T15:26:26+0530",
"can_mark_as_bill": false,
"can_mark_as_unbill": false
}
Create a purchase order
Create a purchase order for your vendor.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
Arguments
business_gst
, business_none
, overseas
, consumer
.vat_registered
,vat_not_registered
,gcc_vat_not_registered
,gcc_vat_registered
,non_gcc
.dz_vat_registered
and dz_vat_not_registered
are supported only for UAE.home_country_mexico
,border_region_mexico
,non_mexico
supported only for MX.For Kenya Edition:
vat_registered
,vat_not_registered
,non_kenya
(A business that is located outside Kenya).For SouthAfrica Edition:
vat_registered
, vat_not_registered
, overseas
(A business that is located outside SouthAfrica).place of contact
given for the contact will be taken)place of contact
given for the contact will be taken)Supported codes for UAE emirates are : Abu Dhabi -
AB
,Ajman - AJ
,Dubai - DU
,Fujairah - FU
,Ras al-Khaimah - RA
,Sharjah - SH
,Umm al-Quwain - UM
.Supported codes for the GCC countries are : United Arab Emirates -
AE
,Saudi Arabia - SA
,Bahrain - BH
,Kuwait - KW
,Oman - OM
,Qatar - QA
.uk
. If the vendor is in an EU country & VAT registered, you are resides in Northen Ireland and purchasing Goods then his VAT treatment is eu_vat_registered
and if he resides outside the UK then his VAT treatment is overseas
(For Pre Brexit, this can be split as eu_vat_registered
, eu_vat_not_registered
and non_eu
).uae_same_tax_group
, uae_reimbursed_expense
and uae_others
. Supported values for Bahrain are bahrain_same_tax_group
, bahrain_transfer_of_concern
, bahrain_disbursement
, bahrain_head_to_branch_transaction
, bahrain_warranty_repair_services
and bahrain_others
. Supported values for KSA are ksa_reimbursed_expense
.Query Parameters
gif
, png
, jpeg
, jpg
, bmp
, pdf
, xls
, xlsx
, doc
and docx
.parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695"
type: POST
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695")
.post(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("POST", "/books/v3/purchaseorders?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"vendor_id": "460000000026049",
"currency_id": "460000000000099",
"contact_persons": [
"460000000026051"
],
"purchaseorder_number": "PO-00001",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"gst_no": "22AAAAA0000A1Z5",
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"reference_number": "ER/0034",
"billing_address_id": "460000000017491",
"crm_owner_id": "string",
"crm_custom_reference_id": 0,
"template_id": "460000000011003",
"date": "2014-02-10",
"delivery_date": "2014-02-10",
"due_date": "string",
"exchange_rate": 1,
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"is_inclusive_tax": false,
"notes": "Please deliver as soon as possible.",
"notes_default": "string",
"terms": "Thanks for your business.",
"terms_default": "string",
"ship_via": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"attention": "string",
"vat_treatment": "string",
"is_update_customer": "string",
"salesorder_id": "460000124728314",
"line_items": [
{
"item_id": "460000000027009",
"account_id": "460000000074003",
"name": "Hard Drive",
"description": "string",
"unit": "Nos",
"warehouse_id": 460000000026051,
"hsn_or_sac": "string",
"reverse_charge_tax_id": 460000000026068,
"rate": 112,
"quantity": 1,
"item_order": 0,
"tax_id": "string",
"tds_tax_id": 90300000087370,
"tax_treatment_code": "uae_others",
"tax_exemption_code": "string",
"tax_exemption_id": "string",
"acquisition_vat_id": "string",
"reverse_charge_vat_id": "string",
"item_custom_fields": [
{
"index": 1,
"value": "Normal"
}
],
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"project_id": 90300000087378
}
],
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"documents": [
{
"document_id": 0,
"file_name": "string"
}
]
}
{
"code": 0,
"message": "Purchase Order has been added.",
"purchaseorder": {
"purchaseorder_id": "460000000062001",
"documents": [
{
"document_id": 0,
"file_name": "string"
}
],
"vat_treatment": "string",
"gst_no": "22AAAAA0000A1Z5",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"is_pre_gst": false,
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"pricebook_name": "",
"is_reverse_charge_applied": false,
"purchaseorder_number": "PO-00001",
"date": "2014-02-10",
"expected_delivery_date": "string",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"reference_number": "ER/0034",
"status": "draft",
"vendor_id": "460000000026049",
"vendor_name": "string",
"crm_owner_id": "string",
"contact_persons": [
"460000000026051"
],
"currency_id": "460000000000099",
"currency_code": "INR",
"currency_symbol": "string",
"exchange_rate": 1,
"delivery_date": "2014-02-10",
"is_emailed": false,
"is_inclusive_tax": false,
"line_items": [
{
"item_id": "460000000027009",
"line_item_id": "460000000074009",
"sku": "string",
"warehouse_id": 460000000026051,
"warehouse_name": "string",
"product_type": "string",
"reverse_charge_tax_id": 460000000026068,
"reverse_charge_tax_name": "inter",
"reverse_charge_tax_percentage": 10,
"reverse_charge_tax_amount": 100,
"account_id": "460000000074003",
"account_name": "Other Expenses",
"name": "Hard Drive",
"description": "string",
"item_order": 0,
"bcy_rate": 40,
"unit": "Nos",
"rate": 112,
"quantity": 1,
"item_total": 40,
"item_total_inclusive_of_tax": 40,
"tax_exemption_id": "string",
"tax_exemption_code": "string",
"tax_id": "string",
"tax_treatment_code": "uae_others",
"tax_name": "string",
"tax_type": "tax",
"tax_percentage": 0,
"hsn_or_sac": "string",
"acquisition_vat_id": "string",
"acquisition_vat_name": "string",
"acquisition_vat_percentage": "string",
"acquisition_vat_amount": "string",
"reverse_charge_vat_id": "string",
"reverse_charge_vat_name": "string",
"reverse_charge_vat_percentage": "string",
"reverse_charge_vat_amount": "string",
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"item_custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"project_id": 90300000087378,
"project_name": "Sample Project"
}
],
"sub_total": 40,
"tax_total": 0,
"total": 40,
"taxes": [
"string"
],
"acquisition_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"acquisition_vat_total": 0.1,
"reverse_charge_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"reverse_charge_vat_total": 0.1,
"billing_address": {
"address": "string",
"street2": "McMillan Avenue",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string"
},
"notes": "Please deliver as soon as possible.",
"terms": "Thanks for your business.",
"ship_via": "string",
"ship_via_id": "string",
"attention": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"delivery_address": {
"zip": "string",
"is_verifiable": true,
"state": "string",
"address1": "string",
"address2": "string",
"is_valid": "string",
"city": "string",
"country": "string",
"address": "string",
"email": "peterparker@bowmanfurniture.com",
"is_primary": "string",
"organization_address_id": "string",
"phone": "+1-925-929-7211",
"is_verified": false
},
"price_precision": 2,
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"attachment_name": "7.png",
"can_send_in_mail": false,
"template_id": "460000000011003",
"template_name": "Standard Template",
"page_width": "8.27in",
"page_height": "11.69in",
"orientation": "portrait",
"template_type": "standard",
"created_time": "2014-02-10T15:26:26+0530",
"created_by_id": "460000000053001",
"last_modified_time": "2014-02-10T15:26:26+0530",
"can_mark_as_bill": false,
"can_mark_as_unbill": false
}
}
Update a purchase order using a custom field's unique value
A custom field will have unique values if it's configured to not accept duplicate values. Now, you can use that custom field's value to update a purchase order by providing its API name in the X-Unique-Identifier-Key header and its value in the X-Unique-Identifier-Value header. Based on this value, the corresponding purchase order will be retrieved and updated. Additionally, there is an optional X-Upsert header. If the X-Upsert header is true and the custom field's unique value is not found in any of the existing purchase orders, a new purchase order will be created if the necessary payload details are available
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
Arguments
business_gst
, business_none
, overseas
, consumer
.vat_registered
,vat_not_registered
,gcc_vat_not_registered
,gcc_vat_registered
,non_gcc
.dz_vat_registered
and dz_vat_not_registered
are supported only for UAE.home_country_mexico
,border_region_mexico
,non_mexico
supported only for MX.For Kenya Edition:
vat_registered
,vat_not_registered
,non_kenya
(A business that is located outside Kenya).For SouthAfrica Edition:
vat_registered
, vat_not_registered
, overseas
(A business that is located outside SouthAfrica).place of contact
given for the contact will be taken)place of contact
given for the contact will be taken)Supported codes for UAE emirates are : Abu Dhabi -
AB
,Ajman - AJ
,Dubai - DU
,Fujairah - FU
,Ras al-Khaimah - RA
,Sharjah - SH
,Umm al-Quwain - UM
.Supported codes for the GCC countries are : United Arab Emirates -
AE
,Saudi Arabia - SA
,Bahrain - BH
,Kuwait - KW
,Oman - OM
,Qatar - QA
.uk
. If the vendor is in an EU country & VAT registered, you are resides in Northen Ireland and purchasing Goods then his VAT treatment is eu_vat_registered
and if he resides outside the UK then his VAT treatment is overseas
(For Pre Brexit, this can be split as eu_vat_registered
, eu_vat_not_registered
and non_eu
).uae_same_tax_group
, uae_reimbursed_expense
and uae_others
. Supported values for Bahrain are bahrain_same_tax_group
, bahrain_transfer_of_concern
, bahrain_disbursement
, bahrain_head_to_branch_transaction
, bahrain_warranty_repair_services
and bahrain_others
. Supported values for KSA are ksa_reimbursed_expense
.parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("X-Unique-Identifier-Key", "cf_unique_cf");
headers_data.put("X-Unique-Identifier-Value", "unique Value");
headers_data.put("X-Upsert", "true");
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695")
.put(body)
.addHeader("X-Unique-Identifier-Key", "cf_unique_cf")
.addHeader("X-Unique-Identifier-Value", "unique Value")
.addHeader("X-Upsert", "true")
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
'X-Unique-Identifier-Key': 'cf_unique_cf',
'X-Unique-Identifier-Value': 'unique Value',
'X-Upsert': 'true',
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'X-Unique-Identifier-Key': "cf_unique_cf",
'X-Unique-Identifier-Value': "unique Value",
'X-Upsert': "true",
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/books/v3/purchaseorders?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders?organization_id=10234695",
"headers": {
"X-Unique-Identifier-Key": "cf_unique_cf",
"X-Unique-Identifier-Value": "unique Value",
"X-Upsert": "true",
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'X-Unique-Identifier-Key: cf_unique_cf' \
--header 'X-Unique-Identifier-Value: unique Value' \
--header 'X-Upsert: true' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"vendor_id": "460000000026049",
"currency_id": "460000000000099",
"contact_persons": [
"460000000026051"
],
"purchaseorder_number": "PO-00001",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"gst_no": "22AAAAA0000A1Z5",
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"reference_number": "ER/0034",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"billing_address_id": "460000000017491",
"crm_owner_id": "string",
"crm_custom_reference_id": 0,
"template_id": "460000000011003",
"date": "2014-02-10",
"delivery_date": "2014-02-10",
"due_date": "string",
"exchange_rate": 1,
"is_inclusive_tax": false,
"notes": "Please deliver as soon as possible.",
"notes_default": "string",
"terms": "Thanks for your business.",
"terms_default": "string",
"ship_via": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"attention": "string",
"vat_treatment": "string",
"is_update_customer": "string",
"salesorder_id": "460000124728314",
"line_items": [
{
"line_item_id": "460000000074009",
"item_id": "460000000027009",
"account_id": "460000000074003",
"name": "Hard Drive",
"description": "string",
"unit": "Nos",
"warehouse_id": 460000000026051,
"hsn_or_sac": "string",
"reverse_charge_tax_id": 460000000026068,
"rate": 112,
"quantity": 1,
"item_order": 0,
"tax_id": "string",
"tds_tax_id": 90300000087370,
"tax_treatment_code": "uae_others",
"tax_exemption_code": "string",
"tax_exemption_id": "string",
"acquisition_vat_id": "string",
"reverse_charge_vat_id": "string",
"item_custom_fields": [
{
"index": 1,
"value": "Normal"
}
],
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"project_id": 90300000087378
}
],
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"documents": [
{
"document_id": 0,
"file_name": "string"
}
]
}
{
"code": 0,
"message": "Purchase Order has been updated.",
"purchaseorder": {
"purchaseorder_id": "460000000062001",
"documents": [
{
"document_id": 0,
"file_name": "string"
}
],
"vat_treatment": "string",
"gst_no": "22AAAAA0000A1Z5",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"is_pre_gst": false,
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"pricebook_name": "",
"is_reverse_charge_applied": false,
"purchaseorder_number": "PO-00001",
"date": "2014-02-10",
"expected_delivery_date": "string",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"reference_number": "ER/0034",
"status": "draft",
"vendor_id": "460000000026049",
"vendor_name": "string",
"crm_owner_id": "string",
"contact_persons": [
"460000000026051"
],
"currency_id": "460000000000099",
"currency_code": "INR",
"currency_symbol": "string",
"exchange_rate": 1,
"delivery_date": "2014-02-10",
"is_emailed": false,
"is_inclusive_tax": false,
"line_items": [
{
"item_id": "460000000027009",
"line_item_id": "460000000074009",
"sku": "string",
"warehouse_id": 460000000026051,
"warehouse_name": "string",
"product_type": "string",
"reverse_charge_tax_id": 460000000026068,
"reverse_charge_tax_name": "inter",
"reverse_charge_tax_percentage": 10,
"reverse_charge_tax_amount": 100,
"account_id": "460000000074003",
"account_name": "Other Expenses",
"name": "Hard Drive",
"description": "string",
"item_order": 0,
"bcy_rate": 40,
"unit": "Nos",
"rate": 112,
"quantity": 1,
"item_total": 40,
"item_total_inclusive_of_tax": 40,
"tax_exemption_id": "string",
"tax_exemption_code": "string",
"tax_id": "string",
"tax_treatment_code": "uae_others",
"tax_name": "string",
"tax_type": "tax",
"tax_percentage": 0,
"hsn_or_sac": "string",
"acquisition_vat_id": "string",
"acquisition_vat_name": "string",
"acquisition_vat_percentage": "string",
"acquisition_vat_amount": "string",
"reverse_charge_vat_id": "string",
"reverse_charge_vat_name": "string",
"reverse_charge_vat_percentage": "string",
"reverse_charge_vat_amount": "string",
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"item_custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"project_id": 90300000087378,
"project_name": "Sample Project"
}
],
"sub_total": 40,
"tax_total": 0,
"total": 40,
"taxes": [
"string"
],
"acquisition_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"acquisition_vat_total": 0.1,
"reverse_charge_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"reverse_charge_vat_total": 0.1,
"billing_address": {
"address": "string",
"street2": "McMillan Avenue",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string"
},
"notes": "Please deliver as soon as possible.",
"terms": "Thanks for your business.",
"ship_via": "string",
"ship_via_id": "string",
"attention": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"delivery_address": {
"zip": "string",
"is_verifiable": true,
"state": "string",
"address1": "string",
"address2": "string",
"is_valid": "string",
"city": "string",
"country": "string",
"address": "string",
"email": "peterparker@bowmanfurniture.com",
"is_primary": "string",
"organization_address_id": "string",
"phone": "+1-925-929-7211",
"is_verified": false
},
"price_precision": 2,
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"attachment_name": "7.png",
"can_send_in_mail": false,
"template_id": "460000000011003",
"template_name": "Standard Template",
"page_width": "8.27in",
"page_height": "11.69in",
"orientation": "portrait",
"template_type": "standard",
"created_time": "2014-02-10T15:26:26+0530",
"created_by_id": "460000000053001",
"last_modified_time": "2014-02-10T15:26:26+0530",
"can_mark_as_bill": false,
"can_mark_as_unbill": false
}
}
List purchase orders
List all purchase orders.
OAuth Scope : ZohoBooks.purchaseorders.READ
Query Parameters
purchaseorder_number.startswith
and purchaseorder_number.contains
reference_number.startswith
and reference_number.contains
draft
, open
, billed
and cancelled
item_description.startswith
and item_description.contains
vendor_name.startswith
and vendor_name.contains
total.start
, total.end
, total.less_than
, total.less_equals
, total.greater_than
and total.greater_equals
Status.All
, Status.Draft
, Status.Open
, Status.Billed
and Status.Cancelled
.vendor_name
, purchaseorder_number
, date
, delivery_date
, total
and created_time
.custom_field_startswith
, custom_field_contains
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request GET \
--url 'https://www.zohoapis.com/books/v3/purchaseorders?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "success",
"purchaseorders": [
{
"purchaseorder_id": "460000000062001",
"vendor_id": "460000000026049",
"vendor_name": "string",
"status": "draft",
"purchaseorder_number": "PO-00001",
"reference_number": "ER/0034",
"date": "2014-02-10",
"delivery_date": "2014-02-10",
"currency_id": "460000000000099",
"currency_code": "INR",
"price_precision": 2,
"total": 40,
"has_attachment": false,
"created_time": "2014-02-10T15:26:26+0530",
"last_modified_time": "2014-02-10T15:26:26+0530",
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
]
},
{...},
{...}
]
}
Update a purchase order
Update an existing purchase order.
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
Arguments
business_gst
, business_none
, overseas
, consumer
.vat_registered
,vat_not_registered
,gcc_vat_not_registered
,gcc_vat_registered
,non_gcc
.dz_vat_registered
and dz_vat_not_registered
are supported only for UAE.home_country_mexico
,border_region_mexico
,non_mexico
supported only for MX.For Kenya Edition:
vat_registered
,vat_not_registered
,non_kenya
(A business that is located outside Kenya).For SouthAfrica Edition:
vat_registered
, vat_not_registered
, overseas
(A business that is located outside SouthAfrica).place of contact
given for the contact will be taken)place of contact
given for the contact will be taken)Supported codes for UAE emirates are : Abu Dhabi -
AB
,Ajman - AJ
,Dubai - DU
,Fujairah - FU
,Ras al-Khaimah - RA
,Sharjah - SH
,Umm al-Quwain - UM
.Supported codes for the GCC countries are : United Arab Emirates -
AE
,Saudi Arabia - SA
,Bahrain - BH
,Kuwait - KW
,Oman - OM
,Qatar - QA
.uk
. If the vendor is in an EU country & VAT registered, you are resides in Northen Ireland and purchasing Goods then his VAT treatment is eu_vat_registered
and if he resides outside the UK then his VAT treatment is overseas
(For Pre Brexit, this can be split as eu_vat_registered
, eu_vat_not_registered
and non_eu
).uae_same_tax_group
, uae_reimbursed_expense
and uae_others
. Supported values for Bahrain are bahrain_same_tax_group
, bahrain_transfer_of_concern
, bahrain_disbursement
, bahrain_head_to_branch_transaction
, bahrain_warranty_repair_services
and bahrain_others
. Supported values for KSA are ksa_reimbursed_expense
.Query Parameters
gif
, png
, jpeg
, jpg
, bmp
, pdf
, xls
, xlsx
, doc
and docx
.parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/books/v3/purchaseorders/?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"vendor_id": "460000000026049",
"currency_id": "460000000000099",
"contact_persons": [
"460000000026051"
],
"purchaseorder_number": "PO-00001",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"gst_no": "22AAAAA0000A1Z5",
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"reference_number": "ER/0034",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"billing_address_id": "460000000017491",
"crm_owner_id": "string",
"crm_custom_reference_id": 0,
"template_id": "460000000011003",
"date": "2014-02-10",
"delivery_date": "2014-02-10",
"due_date": "string",
"exchange_rate": 1,
"is_inclusive_tax": false,
"notes": "Please deliver as soon as possible.",
"notes_default": "string",
"terms": "Thanks for your business.",
"terms_default": "string",
"ship_via": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"attention": "string",
"vat_treatment": "string",
"is_update_customer": "string",
"salesorder_id": "460000124728314",
"line_items": [
{
"line_item_id": "460000000074009",
"item_id": "460000000027009",
"account_id": "460000000074003",
"name": "Hard Drive",
"description": "string",
"unit": "Nos",
"warehouse_id": 460000000026051,
"hsn_or_sac": "string",
"reverse_charge_tax_id": 460000000026068,
"rate": 112,
"quantity": 1,
"item_order": 0,
"tax_id": "string",
"tds_tax_id": 90300000087370,
"tax_treatment_code": "uae_others",
"tax_exemption_code": "string",
"tax_exemption_id": "string",
"acquisition_vat_id": "string",
"reverse_charge_vat_id": "string",
"item_custom_fields": [
{
"index": 1,
"value": "Normal"
}
],
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"project_id": 90300000087378
}
],
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"documents": [
{
"document_id": 0,
"file_name": "string"
}
]
}
{
"code": 0,
"message": "Purchase Order has been updated.",
"purchaseorder": {
"purchaseorder_id": "460000000062001",
"documents": [
{
"document_id": 0,
"file_name": "string"
}
],
"vat_treatment": "string",
"gst_no": "22AAAAA0000A1Z5",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"is_pre_gst": false,
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"pricebook_name": "",
"is_reverse_charge_applied": false,
"purchaseorder_number": "PO-00001",
"date": "2014-02-10",
"expected_delivery_date": "string",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"reference_number": "ER/0034",
"status": "draft",
"vendor_id": "460000000026049",
"vendor_name": "string",
"crm_owner_id": "string",
"contact_persons": [
"460000000026051"
],
"currency_id": "460000000000099",
"currency_code": "INR",
"currency_symbol": "string",
"exchange_rate": 1,
"delivery_date": "2014-02-10",
"is_emailed": false,
"is_inclusive_tax": false,
"line_items": [
{
"item_id": "460000000027009",
"line_item_id": "460000000074009",
"sku": "string",
"warehouse_id": 460000000026051,
"warehouse_name": "string",
"product_type": "string",
"reverse_charge_tax_id": 460000000026068,
"reverse_charge_tax_name": "inter",
"reverse_charge_tax_percentage": 10,
"reverse_charge_tax_amount": 100,
"account_id": "460000000074003",
"account_name": "Other Expenses",
"name": "Hard Drive",
"description": "string",
"item_order": 0,
"bcy_rate": 40,
"unit": "Nos",
"rate": 112,
"quantity": 1,
"item_total": 40,
"item_total_inclusive_of_tax": 40,
"tax_exemption_id": "string",
"tax_exemption_code": "string",
"tax_id": "string",
"tax_treatment_code": "uae_others",
"tax_name": "string",
"tax_type": "tax",
"tax_percentage": 0,
"hsn_or_sac": "string",
"acquisition_vat_id": "string",
"acquisition_vat_name": "string",
"acquisition_vat_percentage": "string",
"acquisition_vat_amount": "string",
"reverse_charge_vat_id": "string",
"reverse_charge_vat_name": "string",
"reverse_charge_vat_percentage": "string",
"reverse_charge_vat_amount": "string",
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"item_custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"project_id": 90300000087378,
"project_name": "Sample Project"
}
],
"sub_total": 40,
"tax_total": 0,
"total": 40,
"taxes": [
"string"
],
"acquisition_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"acquisition_vat_total": 0.1,
"reverse_charge_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"reverse_charge_vat_total": 0.1,
"billing_address": {
"address": "string",
"street2": "McMillan Avenue",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string"
},
"notes": "Please deliver as soon as possible.",
"terms": "Thanks for your business.",
"ship_via": "string",
"ship_via_id": "string",
"attention": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"delivery_address": {
"zip": "string",
"is_verifiable": true,
"state": "string",
"address1": "string",
"address2": "string",
"is_valid": "string",
"city": "string",
"country": "string",
"address": "string",
"email": "peterparker@bowmanfurniture.com",
"is_primary": "string",
"organization_address_id": "string",
"phone": "+1-925-929-7211",
"is_verified": false
},
"price_precision": 2,
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"attachment_name": "7.png",
"can_send_in_mail": false,
"template_id": "460000000011003",
"template_name": "Standard Template",
"page_width": "8.27in",
"page_height": "11.69in",
"orientation": "portrait",
"template_type": "standard",
"created_time": "2014-02-10T15:26:26+0530",
"created_by_id": "460000000053001",
"last_modified_time": "2014-02-10T15:26:26+0530",
"can_mark_as_bill": false,
"can_mark_as_unbill": false
}
}
Get a purchase order
Get the details of a purchase order.
OAuth Scope : ZohoBooks.purchaseorders.READ
Query Parameters
json
, pdf
and html
.headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders/?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request GET \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "success",
"purchaseorder": {
"purchaseorder_id": "460000000062001",
"documents": [
{
"document_id": 0,
"file_name": "string"
}
],
"vat_treatment": "string",
"gst_no": "22AAAAA0000A1Z5",
"gst_treatment": "business_gst",
"tax_treatment": "vat_registered",
"is_pre_gst": false,
"source_of_supply": "AP",
"destination_of_supply": "TN",
"place_of_supply": "DU",
"pricebook_id": 460000000026089,
"pricebook_name": "",
"is_reverse_charge_applied": false,
"purchaseorder_number": "PO-00001",
"date": "2014-02-10",
"expected_delivery_date": "string",
"discount": "10",
"discount_account_id": "460000000011105",
"is_discount_before_tax": true,
"reference_number": "ER/0034",
"status": "draft",
"vendor_id": "460000000026049",
"vendor_name": "string",
"crm_owner_id": "string",
"contact_persons": [
"460000000026051"
],
"currency_id": "460000000000099",
"currency_code": "INR",
"currency_symbol": "string",
"exchange_rate": 1,
"delivery_date": "2014-02-10",
"is_emailed": false,
"is_inclusive_tax": false,
"line_items": [
{
"item_id": "460000000027009",
"line_item_id": "460000000074009",
"sku": "string",
"warehouse_id": 460000000026051,
"warehouse_name": "string",
"product_type": "string",
"reverse_charge_tax_id": 460000000026068,
"reverse_charge_tax_name": "inter",
"reverse_charge_tax_percentage": 10,
"reverse_charge_tax_amount": 100,
"account_id": "460000000074003",
"account_name": "Other Expenses",
"name": "Hard Drive",
"description": "string",
"item_order": 0,
"bcy_rate": 40,
"unit": "Nos",
"rate": 112,
"quantity": 1,
"item_total": 40,
"item_total_inclusive_of_tax": 40,
"tax_exemption_id": "string",
"tax_exemption_code": "string",
"tax_id": "string",
"tax_treatment_code": "uae_others",
"tax_name": "string",
"tax_type": "tax",
"tax_percentage": 0,
"hsn_or_sac": "string",
"acquisition_vat_id": "string",
"acquisition_vat_name": "string",
"acquisition_vat_percentage": "string",
"acquisition_vat_amount": "string",
"reverse_charge_vat_id": "string",
"reverse_charge_vat_name": "string",
"reverse_charge_vat_percentage": "string",
"reverse_charge_vat_amount": "string",
"tags": [
{
"tag_id": 0,
"tag_option_id": 0
}
],
"item_custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"project_id": 90300000087378,
"project_name": "Sample Project"
}
],
"sub_total": 40,
"tax_total": 0,
"total": 40,
"taxes": [
"string"
],
"acquisition_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"acquisition_vat_total": 0.1,
"reverse_charge_vat_summary": [
{
"tax_name": "string",
"tax_amount": 0.1
}
],
"reverse_charge_vat_total": 0.1,
"billing_address": {
"address": "string",
"street2": "McMillan Avenue",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string"
},
"notes": "Please deliver as soon as possible.",
"terms": "Thanks for your business.",
"ship_via": "string",
"ship_via_id": "string",
"attention": "string",
"delivery_org_address_id": "string",
"delivery_customer_id": "string",
"delivery_address": {
"zip": "string",
"is_verifiable": true,
"state": "string",
"address1": "string",
"address2": "string",
"is_valid": "string",
"city": "string",
"country": "string",
"address": "string",
"email": "peterparker@bowmanfurniture.com",
"is_primary": "string",
"organization_address_id": "string",
"phone": "+1-925-929-7211",
"is_verified": false
},
"price_precision": 2,
"custom_fields": [
{
"customfield_id": "46000000012845",
"value": "Normal"
}
],
"attachment_name": "7.png",
"can_send_in_mail": false,
"template_id": "460000000011003",
"template_name": "Standard Template",
"page_width": "8.27in",
"page_height": "11.69in",
"orientation": "portrait",
"template_type": "standard",
"created_time": "2014-02-10T15:26:26+0530",
"created_by_id": "460000000053001",
"last_modified_time": "2014-02-10T15:26:26+0530",
"can_mark_as_bill": false,
"can_mark_as_unbill": false
}
}
Delete purchase order
Delete an existing purchase order.
OAuth Scope : ZohoBooks.purchaseorders.DELETE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695"
type: DELETE
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695")
.delete(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'DELETE',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("DELETE", "/books/v3/purchaseorders/?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "DELETE",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request DELETE \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The purchase order has been deleted."
}
Update custom field in existing purchaseorders
Update the value of the custom field in existing purchaseorders.
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
Arguments
Query Parameters
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorder/460000000062001/customfields?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
[
{
"customfield_id": "46000000012845",
"value": "Normal"
}
]
{
"code": 0,
"message": "Custom Fields Updated Successfully"
}
Mark a purchase order as open
Mark a draft purchase order as open.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/open?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The purchase order has been marked as open."
}
Mark as billed
Mark a purchase order as billed.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/billed?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The purchase order has been marked as billed."
}
Cancel a purchase order
Mark a purchase order as cancelled.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/status/cancelled?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The purchase order has been cancelled."
}
Submit a purchase order for approval
Submit a purchase order for approval.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/submit?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The purchase order has been successfully submitted for approval."
}
Approve a purchase order
Approve a purchase order.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/approve?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "You have approved the Purchase Order."
}
Email a purchase order
Email a purchase order to the vendor. Input json string is not mandatory. If input json string is empty, mail will be send with default mail content.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
Arguments
Query Parameters
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695"
type: POST
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695")
.post(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("POST", "/books/v3/purchaseorders/460000000062001/email?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/email?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"send_from_org_email_id": true,
"from_address_id": "460000008392548",
"to_mail_ids": [
"willsmith@bowmanfurniture.com"
],
"cc_mail_ids": [
"peterparker@bowmanfurniture.com"
],
"bcc_mail_ids": [
"mark@safInstruments.com"
],
"subject": "Purchase Order from Zillium Inc (PO #: PO-00001)",
"body": "Dear Bowman and Co, <br><br>The purchase order (PO-00001) is attached with this email. <br><br>An overview of the purchase order is available below: <br>Purchase Order # : PO-00001 <br>Date : 10 Feb 2014 <br>Amount : $112.00(in USD) <br><br>Please go through it and confirm the order. We look forward to working with you again<br><br><br><br>Regards<br><br>Zillium Inc<br><br>",
"mail_documents": [
{
"document_id": 0,
"file_name": "string"
}
]
}
{
"code": 0,
"message": "Your purchase order has been sent."
}
Get purchase order email content
Get the email content of a purchase order.
OAuth Scope : ZohoBooks.purchaseorders.READ
Query Parameters
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders/460000000062001/email?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/email?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request GET \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/email?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "success"
}
Update billing address
Updates the billing address for this purchase order alone.
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
Arguments
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/address/billing?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"address": "string",
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"fax": "string",
"attention": "string",
"is_update_customer": "string"
}
{
"code": 0,
"message": "Billing address updated."
}
List purchase order templates
Get all purchase order pdf templates.
OAuth Scope : ZohoBooks.purchaseorders.READ
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/templates?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/templates?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/templates?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders/templates?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/templates?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request GET \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/templates?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "success",
"templates": [
{
"template_name": "Standard Template",
"template_id": "460000000011003",
"template_type": "standard"
},
{...},
{...}
]
}
Update purchase order template
Update the pdf template associated with the purchase order.
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695"
type: PUT
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695")
.put(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("PUT", "/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/templates/460000000011003?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "Purchase Order has been updated."
}
Add attachment to a purchase order
Attach a file to a purchase order.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
Query Parameters
gif
, png
, jpeg
, jpg
, bmp
, pdf
, xls
, xlsx
, doc
and docx
.headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695"
type: POST
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695")
.post(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("POST", "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The document has been attached."
}
Update attachment preference
Set whether you want to send the attached file while emailing the purchase order.
OAuth Scope : ZohoBooks.purchaseorders.UPDATE
Query Parameters
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false"
type: PUT
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false")
.put(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'PUT',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("PUT", "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "PUT",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request PUT \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695&can_send_in_mail=false' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "Purchase Order has been updated."
}
Get a purchase order attachment
Returns the file attached to the purchase order.
OAuth Scope : ZohoBooks.purchaseorders.READ
Query Parameters
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "GET",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request GET \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "success"
}
Delete an attachment
Delete the file attached to the purchase order.
OAuth Scope : ZohoBooks.purchaseorders.DELETE
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695"
type: DELETE
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695")
.delete(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'DELETE',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("DELETE", "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "DELETE",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
curl --request DELETE \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/attachment?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"code": 0,
"message": "The attachment has been deleted."
}
Add comment
Add a comment for a purchase order.
OAuth Scope : ZohoBooks.purchaseorders.CREATE
Arguments
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695"
type: POST
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695")
.post(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'POST',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f',
'content-type': 'application/json'
},
body: '{"field1":"value1","field2":"value2"}'
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("POST", "/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const http = require("https");
const options = {
"method": "POST",
"hostname": "www.zohoapis.com",
"port": null,
"path": "/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
curl --request POST \
--url 'https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695' \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"description": "string",
"expected_delivery_date": "string"
}
{
"code": 0,
"message": "Comments added.",
"comment": {
"comment_id": "460000000012345",
"purchaseorder_id": "460000000062001",
"description": "string",
"commented_by_id": "string",
"commented_by": "string",
"comment_type": "system",
"date": "2014-02-10",
"date_description": "22 hours ago.",
"time": "3.26PM"
}
}
List purchase order comments & history
Get the complete history and comments of purchase order.
OAuth Scope : ZohoBooks.purchaseorders.READ
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695"
type: GET
headers: headers_data
connection: <connection_name>
]
info response;
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
const options = {
method: 'GET',
headers: {
Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
}
};
fetch('https://www.zohoapis.com/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import http.client
conn = http.client.HTTPSConnection("www.zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/books/v3/purchaseorders/460000000062001/comments?organization_id=10234695", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))