Preview a purchase order
curl --request POST \
--url https://api.watchdog.no/v1/purchase-orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buyer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency_code": "<string>",
"issued_date": "<string>",
"valid_from": "<string>",
"valid_until": "<string>",
"contract_reference": "<string>",
"line_items": [
{
"product_code": "<string>",
"quantity": "<string>",
"unit": "<string>",
"unit_price": "<string>",
"agreement_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agreement_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
supplier_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
buyer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
currency_code: '<string>',
issued_date: '<string>',
valid_from: '<string>',
valid_until: '<string>',
contract_reference: '<string>',
line_items: [
{
product_code: '<string>',
quantity: '<string>',
unit: '<string>',
unit_price: '<string>',
agreement_item_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
]
})
};
fetch('https://api.watchdog.no/v1/purchase-orders/preview', 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/preview"
payload = {
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buyer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency_code": "<string>",
"issued_date": "<string>",
"valid_from": "<string>",
"valid_until": "<string>",
"contract_reference": "<string>",
"line_items": [
{
"product_code": "<string>",
"quantity": "<string>",
"unit": "<string>",
"unit_price": "<string>",
"agreement_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"agreement_check": {
"agreement": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"restricted": true
},
"applicable": true,
"coverage": {
"lines": 123,
"no_difference": 123,
"differs": 123,
"not_checked": 123
},
"findings": [
{
"code": "unit_price",
"target": "<string>",
"applicable": true,
"line_key": "<string>",
"fingerprint": "<string>",
"evidence": {
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"price_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"terms": "<string>"
},
"current_unit_price": "<string>",
"agreement_unit_price": "<string>",
"quantity": "<string>",
"amount_difference": "<string>",
"unit_to_set": "<string>"
}
],
"lines": [
{
"key": "<string>",
"outcome": "no_difference",
"price_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_unit_price": "<string>",
"copied_from_agreement": true,
"price_fingerprint": "<string>",
"terms": "<string>"
}
],
"suggestions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"reason": "contract_reference"
}
],
"dismissed": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>"
}
]
}
}{
"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": "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
Preview a purchase order
Checks an order that is not saved yet against its agreement, from only what the check reads: the agreement, parties, currency, dates, contract reference and each line’s quantity and price facts. Without an agreement it suggests agreements instead. Changes nothing; its findings cannot be applied, since there is no order yet. Lines are keyed by their position in line_items.
Preview a purchase order
curl --request POST \
--url https://api.watchdog.no/v1/purchase-orders/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buyer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency_code": "<string>",
"issued_date": "<string>",
"valid_from": "<string>",
"valid_until": "<string>",
"contract_reference": "<string>",
"line_items": [
{
"product_code": "<string>",
"quantity": "<string>",
"unit": "<string>",
"unit_price": "<string>",
"agreement_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agreement_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
supplier_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
buyer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
currency_code: '<string>',
issued_date: '<string>',
valid_from: '<string>',
valid_until: '<string>',
contract_reference: '<string>',
line_items: [
{
product_code: '<string>',
quantity: '<string>',
unit: '<string>',
unit_price: '<string>',
agreement_item_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
]
})
};
fetch('https://api.watchdog.no/v1/purchase-orders/preview', 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/preview"
payload = {
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"supplier_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"buyer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency_code": "<string>",
"issued_date": "<string>",
"valid_from": "<string>",
"valid_until": "<string>",
"contract_reference": "<string>",
"line_items": [
{
"product_code": "<string>",
"quantity": "<string>",
"unit": "<string>",
"unit_price": "<string>",
"agreement_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"agreement_check": {
"agreement": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"restricted": true
},
"applicable": true,
"coverage": {
"lines": 123,
"no_difference": 123,
"differs": 123,
"not_checked": 123
},
"findings": [
{
"code": "unit_price",
"target": "<string>",
"applicable": true,
"line_key": "<string>",
"fingerprint": "<string>",
"evidence": {
"agreement_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"price_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"terms": "<string>"
},
"current_unit_price": "<string>",
"agreement_unit_price": "<string>",
"quantity": "<string>",
"amount_difference": "<string>",
"unit_to_set": "<string>"
}
],
"lines": [
{
"key": "<string>",
"outcome": "no_difference",
"price_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agreement_unit_price": "<string>",
"copied_from_agreement": true,
"price_fingerprint": "<string>",
"terms": "<string>"
}
],
"suggestions": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"reason": "contract_reference"
}
],
"dismissed": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>"
}
]
}
}{
"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": "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
Body
application/json