Retrieve the list of purchase orders for a center
This API retrieves the list of purchase orders for the specified center during the specified time period.
You must specify appropriate details for the center_id,start_date, and end_date parameters. Optionally, you can provide details for the show_delivery_details,date_criteria, and status parameters.
Before you begin
- You need a valid API key or access token. See Set up API authentication.
Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.
Endpoint
GET /v1/inventory/purchase_orders
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| center_id | string | Yes | {center_id} | Mandatory Unique 32-character identifier of the center. |
| start_date | string (date) | Yes | 2022-11-11 | Mandatory Format: YYYY-MM-DD Start date beginning from which the required purchase orders are to be retrieved. The type of purchase orders to be retrieved depends on the value of the date_criteria parameter. For example, if you specify start_date as 2020-09-05, end_date as 2020-09-07, and date_criteria as 2, this API will retrieve all the purchase orders that were delivered between Sep 5, 2020 and Sep 7, 2020 (both dates inclusive). |
| end_date | string (date) | Yes | 2022-11-12 | Mandatory Format: YYYY-MM-DD Date until which the required purchase orders are to be retrieved. The type of purchase orders to be retrieved depends on the value of the date_criteria parameter. For example, if you specify start_date as 2020-09-05, end_date as 2020-09-07, and date_criteria as 2, this API will retrieve all the purchase orders that were delivered between Sep 5, 2020 and Sep 7, 2020 (both dates inclusive). |
| show_delivery_details | boolean | No | false | Optional Indicates whether the delivery details of the purchase orders are to be displayed. Default value is false. |
| date_criteria | enum (1, 2, 3, 4) | No | 4 | Optional Indicates the type of purchase orders that are to be fetched. Default value is 4. Values are as follows: 1 - Raised, 2 - Delivered, 3 - Completed and 4 - All (fetch purchase orders across all statuses). Note: Delivered will only contain fully delivered purchase orders. It will not fetch partially delivered purchase orders. Completed will fetch both fully delivered and partially delivered purchase orders.` |
| status | enum (-1, 1, 2) | No | -1 | Optional Indicates the status of purchase orders Default value is -1. Values are as follows: 1 - Created, 2 - Raised, and -1 - Any. Note: To retrieve purchase orders in Created/Raised status, use date_criteria=4 with the appropriate status. |
Response
Success (200 OK)
{}
Example
curl --request GET \
--url 'https://api.zenoti.com/v1/inventory/purchase_orders?center_id={{center_id}}&start_date={{start_date}}&end_date={{end_date}}' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/inventory/purchase_orders', {
method: 'GET',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.get(
'https://api.zenoti.com/v1/inventory/purchase_orders',
headers={
'Authorization': 'bearer {{access_token}}',
},
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var response = await client.GetAsync(
"https://api.zenoti.com/v1/inventory/purchase_orders");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/inventory/purchase_orders')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
response = http.request(request)
data = JSON.parse(response.body)
Error codes
| Status | Description |
|---|---|
| 400 | 400 |
| 401 | Unauthorized -- invalid or expired access token |
| 429 | Too many requests -- rate limit exceeded |