This article lists the ToolWatch API requests for cost centers: Create, Retrieve, Retrieve List, Update, and Delete. Every request needs an authorization token. To get one, see ToolWatch API: Authorization.
Create
Request
URI
https://api.{cluster}.toolwatch.net/costcentersHttp Method
POST
Headers
Authorization: {token}
Request Body
Field | Type | Required | Description |
Description | string | Yes | Cost center description. Max 50 characters. |
Number | string | Yes | Cost center number. Max 50 characters. |
StockpointId | guid | No | Stockpoint the cost center belongs to. |
CustomerId | guid | No | Associated customer id. |
Customer | string | No | Customer name. |
ManagerId | guid | No | Cost center manager (entity) id. |
Inactive | boolean | No | Whether the cost center is inactive. |
Notes | string | No | Free-form notes. |
CutOffDate | date | No | Cut-off date. |
StartDate | date | No | Start date. |
EndDate | date | No | Completion date. |
ShippingCostCodeId | guid | No | Shipping cost code id. |
TaxCostCodeId | guid | No | Tax cost code id. |
UseBilling | boolean | No | Whether billing is enabled for this cost center. |
Suffix | string | No | Cost center suffix. |
AllowSelectGlobalCostCodes | boolean | No | Allow selecting global cost codes. |
CodeGroup | string | No | Code group. |
Response
201 Created
The response header contains the URI for the newly created cost center.
Location: https://api.{cluster}.toolwatch.net/costcenters/{id}400 Bad Request
Triggered when field level validation fails.
Response body will contain validation message
[
{
"PropertyName": "Number",
"Message": "Please provide a cost center number.",
"AttemptedValue": ""
}
]
Retrieve
Request
URI
https://api.{cluster}.toolwatch.net/costcenters/{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. |
OrganizationId | string | Organization the cost center belongs to. |
StockpointId | guid | Stockpoint id. |
Number | string | Cost center number. |
Description | string | Cost center description. |
Customer | string | Customer name. |
ManagerId | guid | Cost center manager (entity) id. |
Inactive | boolean | Whether the cost center is inactive. |
StartDate | date | Start date. |
EndDate | date | Completion date. |
Notes | string | Free-form notes. |
CutOffDate | date | Cut-off date. |
LastPostingNumber | integer | Last posting number. |
LastCalcDate | date | Last calculation date. |
ShippingCostCodeId | guid | Shipping cost code id. |
TaxCostCodeId | guid | Tax cost code id. |
Deleted | boolean | Whether the cost center is deleted. |
UseBilling | boolean | Whether billing is enabled for this cost center. |
Suffix | string | Cost center suffix. |
CustomerId | guid | Associated customer id. |
AllowSelectGlobalCostCodes | boolean | Allow selecting global cost codes. |
CodeGroup | string | Code group. |
Example response body:
{
"Id": "{id}",
"Description": "Cost Center",
"Number": "Cost Center Number",
"AllowSelectGlobalCostCodes": true,
"CodeGroup": "Code Group",
"Deleted": false
}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 cost center id.Retrieve List
Request
URI
https://api.{cluster}.toolwatch.net/costcentersAllowable querystring parameters
Parameter | Description |
columns | Comma-separated list of properties to return. |
number | Filter by cost center number. |
stockpointid | Filter by stockpoint id (guid). |
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. |
OrganizationId | string | Organization the cost center belongs to. |
StockpointId | guid | Stockpoint id. |
Number | string | Cost center number. |
Description | string | Cost center description. |
Customer | string | Customer name. |
ManagerId | guid | Cost center manager (entity) id. |
Inactive | boolean | Whether the cost center is inactive. |
StartDate | date | Start date. |
EndDate | date | Completion date. |
Notes | string | Free-form notes. |
CutOffDate | date | Cut-off date. |
LastPostingNumber | integer | Last posting number. |
LastCalcDate | date | Last calculation date. |
ShippingCostCodeId | guid | Shipping cost code id. |
TaxCostCodeId | guid | Tax cost code id. |
Deleted | boolean | Whether the cost center is deleted. |
UseBilling | boolean | Whether billing is enabled for this cost center. |
Suffix | string | Cost center suffix. |
CustomerId | guid | Associated customer id. |
AllowSelectGlobalCostCodes | boolean | Allow selecting global cost codes. |
CodeGroup | string | Code group. |
Example response body:
[
{
"Id": "849197e3-6cc4-4150-ae71-3f2fc1fbc53d",
"Description": "Cost Center 1",
"Number": "Cost Center Number 1",
"AllowSelectGlobalCostCodes": true,
"CodeGroup": "Code Group 1",
"Deleted": false
},
{
"Id": "cc09dbb0-6cc4-4150-ae71-3f2fc1fbc53d",
"Description": "Cost Center 2",
"Number": "Cost Center Number 2",
"AllowSelectGlobalCostCodes": false,
"CodeGroup": "Code Group 2",
"Deleted": false
}
]
404 Not Found
Triggered when field parameters in querystring are not allowed.
Response body will contain error message
{"Message":"Criteria is invalid","Type":"Exception"}Update
Request
URI
https://api.{cluster}.toolwatch.net/costcenters/{id}Http Method
PUT
Headers
Authorization: {token}
Request Body
Supply the model completely. Any property that is omitted is overwritten with its default value.
Field | Type | Required | Description |
Description | string | Yes | Cost center description. Max 50 characters. |
Number | string | Yes | Cost center number. Max 50 characters. |
StockpointId | guid | No | Stockpoint the cost center belongs to. |
CustomerId | guid | No | Associated customer id. |
Customer | string | No | Customer name. |
ManagerId | guid | No | Cost center manager (entity) id. |
Inactive | boolean | No | Whether the cost center is inactive. |
Notes | string | No | Free-form notes. |
CutOffDate | date | No | Cut-off date. |
StartDate | date | No | Start date. |
EndDate | date | No | Completion date. |
ShippingCostCodeId | guid | No | Shipping cost code id. |
TaxCostCodeId | guid | No | Tax cost code id. |
UseBilling | boolean | No | Whether billing is enabled for this cost center. |
Suffix | string | No | Cost center suffix. |
AllowSelectGlobalCostCodes | boolean | No | Allow selecting global cost codes. |
CodeGroup | string | No | Code group. |
Deleted | boolean | No | Whether the cost center is deleted. |
Response
200 Ok
400 Bad Request
Triggered when field level validation fails.
Response body will contain validation message
[
{
"PropertyName": "Number",
"Message": "Please provide a cost center number.",
"AttemptedValue": ""
}
]
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 cost center id.Delete
Request
URI
https://api.{cluster}.toolwatch.net/costcenters/{id}Http Method
DELETE
Headers
Authorization: {token}
Request Body
Not allowed for DELETE
Response
200 Ok
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 cost center id.