Count purchase orders
curl --request GET \
--url https://api.watchdog.no/v1/purchase-orders/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/purchase-orders/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/purchase-orders/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"total_count": 7,
"counts": {
"draft": 3,
"open": 3,
"closed": 1,
"cancelled": 0
},
"awaiting_approval_count": 1,
"with_invoices_count": 3,
"organization_currency": {
"currency_code": "NOK",
"commitment_amount": "250000.00",
"billed_amount": "84210.50"
},
"currencies": [
{
"currency_code": "NOK",
"order_count": 7,
"commitment_amount": "250000.00",
"billed_amount": "84210.50"
}
]
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Purchase orders
Count purchase orders
Counts the purchase orders listPurchaseOrders lists for the same filters, in all, per status and with invoices, and totals their commitment and billed amount excluding VAT per currency and converted to the organization currency, as getInvoiceMetrics does. Archived orders are left out unless archived=true.
Count purchase orders
curl --request GET \
--url https://api.watchdog.no/v1/purchase-orders/metrics \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/purchase-orders/metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.watchdog.no/v1/purchase-orders/metrics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"total_count": 7,
"counts": {
"draft": 3,
"open": 3,
"closed": 1,
"cancelled": 0
},
"awaiting_approval_count": 1,
"with_invoices_count": 3,
"organization_currency": {
"currency_code": "NOK",
"commitment_amount": "250000.00",
"billed_amount": "84210.50"
},
"currencies": [
{
"currency_code": "NOK",
"order_count": 7,
"commitment_amount": "250000.00",
"billed_amount": "84210.50"
}
]
}{
"error": {
"code": "validation_error",
"message": "The request is invalid. details lists up to 20 field errors. Request bodies are limited to 2 MiB.",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "The bearer token is missing or invalid.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied. The error code says why: forbidden, token_disabled, organization_required, insufficient_role or mfa_required.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Wait for the Retry-After delay before retrying.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Temporarily unavailable. Retry after the Retry-After delay, when provided.",
"request_id": "req_example"
}
}Authorizations
Headers
Query Parameters
Response
Purchase order counts and totals.