Skip to main content

ToolWatch API: Departments

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

This article lists the ToolWatch API requests for departments: 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/departments

Http Method

POST

Headers

Authorization: {token}

Request Body

Field

Type

Required

Description

Number

string

Yes

Department number.

Description

string

No

Department description.

Phone

string

No

Phone number.

Fax

string

No

Fax number.

Inactive

boolean

No

Whether the department is inactive.

Response

201 Created

The response header contains the URI for the newly created department.

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

400 Bad Request

Triggered when field level validation fails.

Response body will contain validation message

[
{
"PropertyName": "Number",
"Message": "Please provide a department number.",
"AttemptedValue": ""
}
]

Retrieve

Request

URI

https://api.{cluster}.toolwatch.net/departments/{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.

Number

string

Department number.

Description

string

Department description.

Phone

string

Phone number.

Fax

string

Fax number.

Deleted

boolean

Whether the department is deleted.

Inactive

boolean

Whether the department is inactive.

Example response body:

{
"Id": "{id}",
"Number": "Department Number",
"Description": "Department",
"Phone": "3035551212",
"Fax": "3035551213",
"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 department id.

Retrieve List

Request

URI

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

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.

Number

string

Department number.

Description

string

Department description.

Phone

string

Phone number.

Fax

string

Fax number.

Deleted

boolean

Whether the department is deleted.

Inactive

boolean

Whether the department is inactive.

Example response body:

[
{
"Id": "849197e3-6cc4-4150-ae71-3f2fc1fbc53d",
"Number": "Department Number 1",
"Description": "Department 1",
"Phone": "3035551212",
"Fax": "3035551213",
"Deleted": false
},
{
"Id": "cc09dbb0-6cc4-4150-ae71-3f2fc1fbc53d",
"Number": "Department Number 2",
"Description": "Department 2",
"Phone": "3035551214",
"Fax": "3035551215",
"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"}
Did this answer your question?