Skip to main content

ToolWatch API: Purchase Orders Lines

ToolWatch API requests to create, retrieve, and list purchase order lines, with URIs, headers, fields, and example responses.

This article lists the ToolWatch API requests for purchase order lines: Create, Retrieve, and Retrieve List. Every request needs an authorization token. To get one, see ToolWatch API: Authorization.

Create

Request

URI

https://api.{cluster}.toolwatch.net/purchaseorderlines

Http Method

POST

Headers

Authorization: {token}

Request Body

Field

Type

Required

Description

Id

guid

Yes

Purchase order line id. Must be a new, non-empty guid that you generate.

PurchaseOrderId

guid

Yes

Purchase order id.

Description

string

Yes

Line description. Max 100 characters.

AssetOnOrder

guid

Yes

Master id of the asset on order.

QuantityOrdered

integer

No

Quantity ordered.

QuantityReceived

integer

No

Quantity received.

Cost

decimal

No

Unit cost.

ItemType

string

No

Item type.

Sku

string

No

SKU.

UnitOfMeasure

string

No

Unit of measure.

ItemNumber

string

No

Item number.

CostCenterId

guid

No

Cost center id.

CostCodeId

guid

No

Cost code id.

masterId

guid

No

Master id.

Response

201 Created

The response header contains the URI for the newly created purchase order line.

Location: https://api.{cluster}.toolwatch.net/purchaseorderlines/{id}

400 Bad Request

Triggered when field level validation fails.

Response body will contain validation message

[
{
"PropertyName": "PurchaseOrderId",
"Message": "Please provide a purchase order Id.",
"AttemptedValue": ""
}
]

Retrieve

Request

URI

https://api.{cluster}.toolwatch.net/purchaseorderline/{id}

Allowable querystring parameters

Parameter

Description

columns

Comma-separated list of properties to return.

Http Method

GET

Headers

Authorization: {token}

Request Body

Not allowed for GET

Response

200 Ok

By default every property is returned. Use the columns querystring parameter to limit the response to specific properties.

Field

Type

Description

Id

guid

Unique identifier.

PurchaseOrderId

guid

Purchase order id.

Description

string

Line description.

QuantityOrdered

integer

Quantity ordered.

QuantityReceived

integer

Quantity received.

Cost

decimal

Unit cost.

ItemType

string

Item type.

Sku

string

SKU.

UnitOfMeasure

string

Unit of measure.

AssetOnOrder

guid

Master id of the asset on order.

ItemNumber

string

Item number.

CostCenterId

guid

Cost center id.

CostCodeId

guid

Cost code id.

masterId

guid

Master id.

Example response body:

{
"Id": "{id}",
"PurchaseOrderId": "849197e3-6cc4-4150-ae71-3f2fc1fbc53d",
"Description": "Line Description",
"QuantityOrdered": 5,
"Cost": 19.99,
"Sku": "SKU-123"
}

404 Not Found

Triggered when id parameter is not a valid guid or no matching record was found.

Response body will contain error message

{id} is not a valid purchase order line id.

Retrieve List

Request

URI

https://api.{cluster}.toolwatch.net/purchaseorderlines/{id}

Where {id} is the purchase order id. Returns the lines belonging to that purchase order.

Allowable querystring parameters

Parameter

Description

columns

Comma-separated list of properties to return.

Http Method

GET

Headers

Authorization: {token}

Request Body

Not allowed for GET

Response

200 Ok

By default every property is returned. Use the columns querystring parameter to limit the response to specific properties.

Field

Type

Description

Id

guid

Unique identifier.

PurchaseOrderId

guid

Purchase order id.

Description

string

Line description.

QuantityOrdered

integer

Quantity ordered.

QuantityReceived

integer

Quantity received.

Cost

decimal

Unit cost.

ItemType

string

Item type.

Sku

string

SKU.

UnitOfMeasure

string

Unit of measure.

AssetOnOrder

guid

Master id of the asset on order.

ItemNumber

string

Item number.

CostCenterId

guid

Cost center id.

CostCodeId

guid

Cost code id.

masterId

guid

Master id.

Example response body:

[
{
"Id": "849197e3-6cc4-4150-ae71-3f2fc1fbc53d",
"PurchaseOrderId": "cc09dbb0-6cc4-4150-ae71-3f2fc1fbc53d",
"Description": "Line Description 1",
"QuantityOrdered": 5,
"Cost": 19.99,
"Sku": "SKU-123"
}
]

404 Not Found

Triggered when field parameters in querystring are not allowed.

Response body will contain error message

{"Message":"Criteria is invalid","Type":"Exception"}
Did this answer your question?