Delete a draft purchase order
curl --request DELETE \
--url https://api.watchdog.no/v1/purchase-orders/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/purchase-orders/{id}', 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/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text){
"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": "conflict",
"message": "The order changed since expected_revision, an agreement finding changed since it was read, the terms cannot change while a proposed revision waits (proposal_waiting), the proposed revision was already decided or replaced (stale_proposal), agreement prices need approval (approval_required), the status change is not allowed, no approval waits for a decision or another one than you reviewed is pending, an issued order already uses the number for this buyer, a native order was pushed to an ERP, or its push is queued or running, and so cannot change supplier, buyer, currency or commitment basis, an open order cannot be archived, or only a draft can be deleted.",
"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
Delete a draft purchase order
Deletes a draft with its lines, links and emails; its documents are deleted 30 days later unless something else uses them. An opened order returns 409: cancel or archive it instead.
Delete a draft purchase order
curl --request DELETE \
--url https://api.watchdog.no/v1/purchase-orders/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.watchdog.no/v1/purchase-orders/{id}', 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/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text){
"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": "conflict",
"message": "The order changed since expected_revision, an agreement finding changed since it was read, the terms cannot change while a proposed revision waits (proposal_waiting), the proposed revision was already decided or replaced (stale_proposal), agreement prices need approval (approval_required), the status change is not allowed, no approval waits for a decision or another one than you reviewed is pending, an issued order already uses the number for this buyer, a native order was pushed to an ERP, or its push is queued or running, and so cannot change supplier, buyer, currency or commitment basis, an open order cannot be archived, or only a draft can be deleted.",
"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
Response
The draft is deleted.