### Request Example with Auth Token Source: https://www.zoho.com/inventory/api/v1/errors Example of how to make a GET request to retrieve an invoice using an authentication token and organization ID. ```bash $ curl https://www.zohoapis.com/inventory/v1/invoices/700000007942?authtoken=ba46xxxxxxxxxxxxxxxxxxxxxxxxoec5&organization_id=10234695 ``` -------------------------------- ### Retrieve Package Details using Python (http.client) Source: https://www.zoho.com/inventory/api/v1/packages A Python example using the `http.client` module to make a GET request for package details. It demonstrates setting up the connection and headers. ```Python import http.client conn = http.client.HTTPSConnection("www.zohoapis.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/inventory/v1/packages/504366000000062100?organization_id=10234695", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Create Tax Authority - Java Source: https://www.zoho.com/inventory/api/v1/taxes Example of creating a tax authority using OkHttpClient in Java. Requires proper setup of OkHttpClient and request body. ```java 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/inventory/v1/settings/taxauthorities?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Retrieve Package Details using Java (OkHttpClient) Source: https://www.zoho.com/inventory/api/v1/packages Example using OkHttpClient in Java to fetch package details. This code constructs a GET request with the necessary authorization header and URL. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/packages/504366000000062100?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Response Example for Get Purchase Receives Source: https://www.zoho.com/inventory/api/v1/purchasereceives This is a sample successful response (200 OK) when retrieving purchase receive details. It includes information about the purchase order, vendor, items, and addresses. ```JSON { "code": 0, "message": "success", "purchase_receive": { "purchaseorder_id": 4815000000044972, "purchaseorder_number": "PO-00002", "receive_id": 4815000000045035, "receive_number": "PR-00002", "date": "2015-05-28", "vendor_id": 4815000000044080, "vendor_name": "Molly", "contact_persons": 4815000000044080, "notes": "Sample Note.", "custom_fields": [ { "customfield_id": "46000000012845", "value": "Normal" } ], "line_items": [ { "line_item_id": 4815000000044897, "item_id": 4815000000044100, "name": "Laptop-white/15inch/dell", "description": "Just a sample description.", "item_order": 0, "quantity": 2, "unit": "qty" } ], "billing_address": [ { "address": "No:234,90 Church Street", "city": "New York City", "state": "New York", "zip": 10048, "country": "U.S.A", "fax": "324-524242" } ], "shipping_address": [ { "address": "No:234,90 Church Street", "city": "New York City", "state": "New York", "zip": 10048, "country": "U.S.A", "fax": "324-524242" } ], "created_time": "2015-05-28T00:00:00.000Z", "last_modified_time": "2015-05-28T00:00:00.000Z" } } ``` -------------------------------- ### Get Currencies with Organization ID (Java) Source: https://www.zoho.com/inventory/api/v1/currency Example using OkHttpClient in Java to fetch currency data. This snippet includes setting up the request with the correct URL and authorization header. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/settings/currencies/982000000004012?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Request Contact Person List (Python http.client) Source: https://www.zoho.com/inventory/api/v1/contact-persons Python example using the http.client library to make a GET request for contact persons. Demonstrates setting headers and reading the response. ```python import http.client conn = http.client.HTTPSConnection("www.zohoapis.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/inventory/v1/contacts/460000000026049/contactpersons?organization_id=10234695", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Get Vendor Credit by ID using Java Source: https://www.zoho.com/inventory/api/v1/vendor-credits Example of fetching vendor credit data using Java with OkHttpClient. This code sets up the request with the necessary URL and authorization header. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/vendorcredits/3000000002075?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create User Request in Java (OkHttp) Source: https://www.zoho.com/inventory/api/v1/users Example of creating a user using OkHttp client in Java. This includes setting up the request URL, headers, and request body. ```Java 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/inventory/v1/users?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Locations with Organization ID (Java) Source: https://www.zoho.com/inventory/api/v1/locations Example using OkHttpClient in Java to make a GET request for locations. It includes setting the Authorization header. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/locations?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Currencies with Organization ID (Python) Source: https://www.zoho.com/inventory/api/v1/currency Python example using the http.client library to make a GET request for currency data. It demonstrates setting up the HTTPS connection and headers. ```python import http.client conn = http.client.HTTPSConnection("www.zohoapis.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/inventory/v1/settings/currencies/982000000004012?organization_id=10234695", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Activate a User - Java Source: https://www.zoho.com/inventory/api/v1/users Java code example for activating a user using OkHttp. This snippet demonstrates setting up the request, including the authorization header and URL parameters. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/users/982000000554041/active?organization_id=10234695") .post(null) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Item Details using Javascript Source: https://www.zoho.com/inventory/api/v1/items This Javascript example uses the Fetch API to get item details. It shows how to configure the request method, headers, and handle the JSON response or errors. ```Javascript const options = { method: 'GET', headers: { Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' } }; fetch('https://www.zohoapis.com/inventory/v1/items/4815000000044208?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Create Sales Return - Java Source: https://www.zoho.com/inventory/api/v1/salesreturns Example of creating a sales return using Java with OkHttpClient. This snippet shows how to set up the request body, headers, and execute the POST request. ```Java 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/inventory/v1/salesreturns?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Task by ID with Organization ID Source: https://www.zoho.com/inventory/api/v1/tasks Use this snippet to retrieve a specific task by its ID, ensuring you provide the correct organization ID. The examples demonstrate how to make the GET request in different languages. ```cURL curl --request GET \ --url 'https://www.zohoapis.com/inventory/v1/tasks/982000000567114?organization_id=10234695' \ --header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' ``` ```Deluge headers_data = Map(); headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"); response = invokeUrl [ url: "https://www.zohoapis.com/inventory/v1/tasks/982000000567114?organization_id=10234695" type: GET headers: headers_data connection: ]; info response; ``` ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/tasks/982000000567114?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` ```Javascript const options = { method: 'GET', headers: { Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' } }; fetch('https://www.zohoapis.com/inventory/v1/tasks/982000000567114?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` ```Node.js const http = require("https"); const options = { "method": "GET", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/tasks/982000000567114?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(); ``` ```Python import http.client conn = http.client.HTTPSConnection("www.zohoapis.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/inventory/v1/tasks/982000000567114?organization_id=10234695", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Get Credit Note Comments using Node.js Source: https://www.zoho.com/inventory/api/v1/credit-notes This Node.js example uses the 'https' module to make a GET request for credit note comments. It includes setting up request options and handling the response data. ```javascript const http = require("https"); const options = { "method": "GET", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/creditnotes/90300000072369/comments?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(); ``` -------------------------------- ### Create Pricebook using OkHttpClient (Java) Source: https://www.zoho.com/inventory/api/v1/pricelists This Java code demonstrates how to create a pricebook using OkHttpClient. It includes setting up the request body, URL, and authorization headers. ```Java 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/inventory/v1/pricebooks?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create Customer Payment using Java Source: https://www.zoho.com/inventory/api/v1/customer-payments Example of creating a customer payment using Java with OkHttpClient. This snippet shows how to set up the request body, URL, and headers. ```Java 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/inventory/v1/customerpayments?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get List of Users Response Source: https://www.zoho.com/inventory/api/v1/users Example of a successful response when retrieving the list of users. This indicates the invitation was sent successfully. ```JSON { "code": 0, "message": "Your invitation has been sent." } ``` -------------------------------- ### Response Example for Get Delivery Challan Source: https://www.zoho.com/inventory/api/v1/delivery-challans This is a successful response (200 OK) for retrieving a delivery challan, detailing its various attributes. ```JSON { "code": 0, "message": "success", "deliverychallan": { "deliverychallan_id": "982000000567001", "deliverychallan_number": "DC-00001", "date": "2024-06-15", "challan_type": "job_work", "reference_number": "REF-DC-001", "status": "open", "customer_id": "982000000567001", "customer_name": "Bowman and Co", "currency_id": "982000000000190", "currency_code": "USD", "currency_symbol": "$", "exchange_rate": 1, "is_discount_before_tax": true, "discount_type": "entity_level", "is_inclusive_tax": false, "discount": 0, "place_of_supply": "string", "gst_no": "string", "gst_treatment": "string", "tax_treatment": "string", "line_items": [ { "line_item_id": "982000000567002", "item_id": "982000000030049", "name": "Hard Drive", "sku": "HD-1TB-001", "description": "1TB External Hard Drive", "item_order": 1, "rate": 2500, "bcy_rate": 2500, "quantity": 2, "unit": "Nos", "discount": 0, "tax_id": "982000000030010", "tax_name": "GST", "tax_type": "string", "tax_percentage": 9, "item_total": 5000, "hsn_or_sac": "string", "tax_exemption_id": "string", "tax_exemption_code": "string", "warehouse_id": "string", "warehouse_name": "string", "quantity_invoiced": 0, "quantity_returned": 0, "line_item_taxes": [ { "tax_id": "982000000030010", "tax_name": "GST", "tax_amount": 225 } ] } ], "sub_total": 5000, "tax_total": 450, "total": 5450, "adjustment": 0, "adjustment_description": "string", "shipping_address": { "address": "123 Main Street", "street2": "string", "city": "Chennai", "state": "Tamil Nadu", "zip": "600001", "country": "India", "fax": "string", "phone": "+91-44-12345678", "attention": "string" }, "notes": "Deliver to the reception desk", "terms": "string", "template_id": "982000000567030", "template_name": "Standard Template", "custom_fields": "string", "has_qty_returned": true, "branch_id": "982000000567040", "branch_name": "string", "location_id": "982000000567040", "location_name": "string", "created_time": "2024-06-15T10:30:00+0530", "last_modified_time": "2024-06-15T10:30:00+0530", "created_by_id": "982000000024001" } } ``` -------------------------------- ### Get Invoice Attachment - Python Source: https://www.zoho.com/inventory/api/v1/invoices A Python example for retrieving an invoice attachment. This code uses the http.client library and requires the Authorization header. ```Python import http.client conn = http.client.HTTPSConnection("www.zohoapis.com") headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" } conn.request("GET", "/inventory/v1/invoices/982000000567114/attachment?organization_id=10234695", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Response Example for Query Users Source: https://www.zoho.com/inventory/api/v1/users This is a sample successful response (200 OK) when querying users. It includes user details such as ID, role, name, email, and status. ```JSON { "code": 0, "message": "success", "users": [ { "user_id": "982000000554041", "role_id": "982000000006005", "name": "David John", "email": "johndavid@zilliuminc.com", "user_role": "admin", "user_type": "zoho", "status": "active", "is_current_user": true, "photo_url": "https://contacts.zoho.com/file?ID=d27344a22bad8bb83a03722b4aa5bc6967c3135f24307fe40db8572782432fd6aae0110f8bb9c4c79e8e0f0cca5904aecfacbf079f13b48c295bacc89ae91fca&fs=thumb" }, {...}, {...} ] } ``` -------------------------------- ### Create User Request in Javascript (Fetch API) Source: https://www.zoho.com/inventory/api/v1/users Demonstrates how to create a user using the Fetch API in Javascript. This example shows setting request options including method, headers, and body. ```Javascript 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/inventory/v1/users?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Get Invoice Attachment - Java Source: https://www.zoho.com/inventory/api/v1/invoices Example of fetching an invoice attachment using Java with OkHttpClient. The request includes the necessary Authorization header. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/invoices/982000000567114/attachment?organization_id=10234695") .get() .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Bill Details Source: https://www.zoho.com/inventory/api/v1/bills Retrieves the details of a specific bill using its ID and organization ID. Supports various code examples for integration. ```APIDOC ## GET /bills/{billId} ### Description Retrieves the details of a specific bill. ### Method GET ### Endpoint /inventory/v1/bills/{billId} ### Query Parameters #### Query Parameters - **organization_id** (string) - Required - ID of the organization ### Request Example ```http GET /inventory/v1/bills/4815000000045067?organization_id=10234695 HTTP/1.1 Host: www.zohoapis.com Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f ``` ### Response #### Success Response (200) - **bill_id** (number) - The unique identifier for the bill. - **purchaseorder_id** (number) - The ID of the associated purchase order. - **vendor_id** (number) - The ID of the vendor. - **vendor_name** (string) - The name of the vendor. - **status** (string) - The current status of the bill (e.g., 'paid'). - **bill_number** (string) - The unique number assigned to the bill. - **date** (string) - The date the bill was issued. - **due_date** (string) - The date the bill is due. - **reference_number** (string) - A reference number for the bill. - **currency_code** (string) - The currency code (e.g., 'USD'). - **sub_total** (number) - The total amount before taxes. - **tax_total** (number) - The total tax amount. - **balance** (number) - The remaining balance of the bill. - **created_time** (string) - The timestamp when the bill was created. - **last_modified_time** (string) - The timestamp when the bill was last modified. #### Response Example ```json { "code": 0, "message": "success", "bill": { "bill_id": 4815000000045067, "purchaseorder_id": 4815000000044972, "vendor_id": 4815000000044080, "vendor_name": "Molly", "status": "paid", "bill_number": "BL-00002", "date": "2015-05-29", "due_date": "2015-05-29", "reference_number": "PO-00003", "currency_code": "USD", "sub_total": 30, "tax_total": 2, "balance": 0, "created_time": "2015-05-29T00:00:00.000Z", "last_modified_time": "2015-05-29T00:00:00.000Z" } } ``` ``` -------------------------------- ### Activate a Pricebook - Java Source: https://www.zoho.com/inventory/api/v1/pricelists Java code example for activating a pricebook using OkHttpClient. This includes setting the request URL, method, and Authorization header. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/pricebooks/130426000002924000/active?organization_id=10234695") .post(null) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create Pricebook using Fetch API (JavaScript) Source: https://www.zoho.com/inventory/api/v1/pricelists A JavaScript example using the Fetch API to create a pricebook. It shows how to configure the request method, headers, and body. ```JavaScript 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/inventory/v1/pricebooks?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Response Example for User Update Source: https://www.zoho.com/inventory/api/v1/users This is an example of a successful response (200 OK) when updating user information. It confirms the update operation. ```JSON { "code": 0, "message": "The user information has been updated." } ``` -------------------------------- ### Request Contact Person List (cURL) Source: https://www.zoho.com/inventory/api/v1/contact-persons Command-line example using cURL to fetch contact persons. Demonstrates the GET request method and Authorization header. ```bash curl --request GET \ --url 'https://www.zohoapis.com/inventory/v1/contacts/460000000026049/contactpersons?organization_id=10234695' \ --header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' ``` -------------------------------- ### Successful Response for Get Retainer Invoice Comments Source: https://www.zoho.com/inventory/api/v1/retainer-invoices This is an example of a successful response when retrieving comments for a retainer invoice. It includes details about the comment, the commenter, and the associated transaction. ```JSON { "code": 0, "message": "success", "comments": [ { "comment_id": 982000000567019, "retainerinvoice_id": 982000000567114, "description": "500GB, USB 2.0 interface 1400 rpm, protective hard case.", "commented_by_id": 982000000554041, "commented_by": "John David", "comment_type": "system", "operation_type": "Added", "date": "2013-11-17", "date_description": "yesterday", "time": "2:38 AM", "transaction_id": "982000000567204", "transaction_type": "retainer_payment" }, {...}, {...} ] } ``` -------------------------------- ### Create Location using Java (OkHttpClient) Source: https://www.zoho.com/inventory/api/v1/locations This Java code snippet demonstrates how to create a location using OkHttpClient. It includes setting up the request body, headers, and making the POST request. ```java 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/inventory/v1/locations?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Response Example for Get Retainer Invoice Templates Source: https://www.zoho.com/inventory/api/v1/retainer-invoices This is a sample successful response (200 OK) for retrieving retainer invoice templates, showing the structure of the returned data. ```JSON { "code": 0, "message": "success", "templates": [ { "template_name": "Service - Classic", "template_id": 982000000000143, "template_type": "classic" }, {...}, {...} ] } ``` -------------------------------- ### Create Inventory Adjustment using Java Source: https://www.zoho.com/inventory/api/v1/inventoryadjustments Example of creating an inventory adjustment using Java with OkHttpClient. This code sets up the request body, URL, and headers. ```Java 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/inventory/v1/inventoryadjustments?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Retrieve Contact Comments using Node.js Source: https://www.zoho.com/inventory/api/v1/contacts This Node.js example uses the 'https' module to make a GET request for contact comments, including setting the Authorization header. ```Node.js const http = require("https"); const options = { "method": "GET", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/contacts/460000000026049/comments?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(); ``` -------------------------------- ### Submit Purchase Order for Approval (Java) Source: https://www.zoho.com/inventory/api/v1/purchaseorders Example of submitting a purchase order for approval using Java and OkHttpClient. This snippet shows how to construct the request, set the URL, method, and authorization header. Requires ZohoInventory.purchaseorders.UPDATE scope. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/purchaseorders/4815000000044972/submit?organization_id=10234695") .post(null) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create Sales Return Receive - Java Source: https://www.zoho.com/inventory/api/v1/salesreturns Java code example for creating a sales return receive using OkHttpClient. Includes setting up the request URL, headers, and request body. ```java 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/inventory/v1/salesreturnreceives?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Request Contact Person List (Deluge) Source: https://www.zoho.com/inventory/api/v1/contact-persons Example of how to invoke the Zoho Inventory API to get a list of contact persons using Deluge. Ensure you have the correct authorization header. ```deluge headers_data = Map(); headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"); response = invokeUrl [ url: "https://www.zohoapis.com/inventory/v1/contacts/460000000026049/contactpersons?organization_id=10234695" type: GET headers: headers_data connection: ]; info response; ``` -------------------------------- ### Get Invoice Comments with Organization ID (Node.js) Source: https://www.zoho.com/inventory/api/v1/invoices Retrieve invoice comments using Node.js's built-in https module. This example includes the authorization header and organization ID. ```Node.js const http = require("https"); const options = { "method": "GET", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/invoices/982000000567114/comments?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(); ``` -------------------------------- ### List All Packages Source: https://www.zoho.com/inventory/api/v1/packages Use this endpoint to retrieve a list of all existing packages. Requires ZohoInventory.packages.READ OAuth scope. ```json { "code": 0, "message": "Package created successfully. It's now time to ship!", "package": [ { "billing_address": { "address": "432, Bayside, Queens", "city": "New York City", "state": "New York", "country": "U.S.A", "zip": 11364, "phone": "+1 (999)999-9999", "fax": "416-765-9871" }, "contact_persons": [ { "contact_person_id": 504366000000062000 } ], "created_time": "2017-01-11T00:00:00.000Z", "customer_id": 504366000000062000, "customer_name": "Peter James", "date": "2017-01-11", "email": "jamespeter@pete.com", "is_emailed": false, "last_modified_time": "2017-01-11T00:00:00.000Z", "line_items": [ { "description": "Mobile Sales description", "is_invoiced": false, "item_custom_fields": [ { "customfield_id": 504366000000053100, "data_type": "check_box", "index": 1, "is_active": null, "label": "VAT ID", "placeholder": "cf-504366000000053126", "show_in_all_pdf": null, "show_on_pdf": null, "value": "GBGD078" } ], "item_id": 504366000000053200, "item_order": null, "line_item_id": 504366000000062100, "name": "Apple Iphone", "quantity": 2, "so_line_item_id": 504366000000062000, "sku": "SKUM", "unit": "units" } ], "mobile": "+1 (999)999-9999", "notes": "notes", "package_id": 504366000000062100, "package_number": "PA-00001", "phone": "+1 (999)999-9999", "salesorder_id": 504366000000062000, "salesorder_number": "SO-00001", "shipping_address": { "address": "432, Bayside, Queens", "city": "New York City", "state": "New York", "country": "U.S.A", "zip": 11364, "phone": "+1 (999)999-9999", "fax": "416-765-9871" }, "template_id": 14954000000072020, "template_name": "Standard Template", "template_type": "standard", "total_quantity": 1, "custom_fields": [ { "customfield_id": 504366000000053100, "value": "GBGD078" } ] }, {...}, {...} ] } ``` -------------------------------- ### Get Invoice Comments with Organization ID (JavaScript) Source: https://www.zoho.com/inventory/api/v1/invoices Fetch invoice comments using JavaScript's fetch API. This example includes the necessary authorization header and organization ID. ```JavaScript const options = { method: 'GET', headers: { Authorization: 'Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' } }; fetch('https://www.zohoapis.com/inventory/v1/invoices/982000000567114/comments?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Create Credit Note using Java Source: https://www.zoho.com/inventory/api/v1/credit-notes Example of creating a credit note using Java with OkHttpClient. This code sets up the request body, URL, and authorization headers. ```Java 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/inventory/v1/creditnotes?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Get Vendor Credit by ID using Node.js Source: https://www.zoho.com/inventory/api/v1/vendor-credits Node.js example for retrieving vendor credit data. It configures the request options including method, hostname, path, and authorization header. ```Node.js const http = require("https"); const options = { "method": "GET", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/vendorcredits/3000000002075?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(); ``` -------------------------------- ### Approve Purchase Receive using Java Source: https://www.zoho.com/inventory/api/v1/purchasereceives Approve a purchase receive using Java with OkHttpClient. This example demonstrates setting up the request and headers. ```Java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://www.zohoapis.com/inventory/v1/purchasereceives/4815000000045035/approve?organization_id=10234695") .post(null) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Create Contact Person Request Examples Source: https://www.zoho.com/inventory/api/v1/contact-persons Examples for creating a contact person using different programming languages. Ensure the organization_id is correctly set in the URL. ```cURL curl --request POST \ --url 'https://www.zohoapis.com/inventory/v1/contacts/contactpersons?organization_id=10234695' \ --header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \ --header 'content-type: application/json' \ --data '{"field1":"value1","field2":"value2"}' ``` ```Deluge 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/inventory/v1/contacts/contactpersons?organization_id=10234695" type: POST headers: headers_data content-type: application/json parameters: parameters_data connection: ]; info response; ``` ```Java 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/inventory/v1/contacts/contactpersons?organization_id=10234695") .post(body) .addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f") .addHeader("content-type", "application/json") .build(); Response response = client.newCall(request).execute(); ``` ```Javascript 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/inventory/v1/contacts/contactpersons?organization_id=10234695', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` ```Python 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", "/inventory/v1/contacts/contactpersons?organization_id=10234695", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ```Node.js const http = require("https"); const options = { "method": "POST", "hostname": "www.zohoapis.com", "port": null, "path": "/inventory/v1/contacts/contactpersons?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(); ```