Skip to main content

ToolWatch API: Inventory

ToolWatch API request to list inventory, with URIs, headers, fields, example responses, and sample code.

This article lists the ToolWatch API request for inventory: Retrieve List. Every request needs an authorization token. To get one, see ToolWatch API: Authorization.

Retrieve List

Request

URI

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

Allowable querystring parameters

Parameter

Description

itemtype

Filter by item type: (T)ools, (M)aterials, (Q)uantity Items, or (K)its.

columns

Comma-separated list of properties to return.

assignedToId

Filter by the assigned entity id (guid).

Http Method

GET

Headers

Authorization: {token}

Request Body

Not allowed for GET

Response

200 Ok

Field

Type

Description

ItemId

guid

Unique item identifier.

AssignedTo

string

Description of the entity the item is assigned to.

Description

string

Item (model) description.

ItemNumber

string

Item number.

BarCode

string

Item bar code.

SerialNumber

string

Item serial number.

Deleted

boolean

Whether the item is deleted.

ItemStatusId

guid

Item status code id.

KitId

guid

Kit the item belongs to.

AssignedToId

guid

Id of the entity the item is assigned to.

OwnerId

guid

Owner entity id.

PersonalIssue

boolean

Whether the item is personally issued.

Quantity

integer

On-hand quantity.

Manufacturer

string

Manufacturer name.

Category

string

Category description.

Model

string

Model.

ItemType

string

(T)ool, (Q)uantity, (K)it, or (M)aterial.

Owner

string

Owner description.

ItemStatus

string

Item status description.

Class

string

Class description.

Department

string

Department description.

DepartmentId

guid

Department id.

LicensePlate

string

License plate.

Notes

string

Free-form notes.

PurchaseCost

decimal

Purchase cost.

PurchaseDate

date

Purchase date.

PurchaseOrderNumber

string

Purchase order number.

Example response body:

{
"ItemId": "849197e3-6cc4-4150-ae71-3f2fc1fbc53d",
"ItemNumber": "1001",
"Description": "Cordless Drill",
"AssignedTo": "Main Warehouse",
"Owner": "Main Warehouse",
"ItemStatus": "In Service",
"SerialNumber": "SN-14",
"Manufacturer": "Makita",
"Category": "Drills",
"Model": "XPH07",
"ItemType": "T"
}

404 Not Found

Triggered when field parameters in querystring are not allowed

Response body will contain error message

{"Message":"Criteria is invalid","Type":"Exception"}

Sample Code

This code can be pasted into a new console application and run after you have successfully authenticated and received a token.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;

namespace Align.API.Samples
{
class Inventory
{
static void Main(string[] args)
{
string resultText = GetInventory();
Console.WriteLine(resultText);
Console.ReadLine();
}

public static string GetInventory()
{
var token = "{token}"; // TODO: replace {token} with an actual auth token
string result;
HttpWebResponse response = null;

// querystring set over multiple lines to improve readability
string querystring = "?itemtype=t;columns=itemnumber,assignedto";
querystring += ",owner,itemstatus,serialnumber,manufacturer,category,model";
querystring += ",department,class,licenseplate,notes";

string url = "https://api.{cluster}.toolwatch.net/inventory" + querystring;

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(url);
request.Headers["Authorization"] = token;
request.Method = "GET";
request.ContentType = "application/json";

// GetResponse raises an exception on http status code 400
// We can pull response out of the exception and continue on our way
try
{
response = (HttpWebResponse)request.GetResponse();
} catch (WebException ex)
{
response = (HttpWebResponse)ex.Response;
}
finally
{
using (StreamReader reader =
new StreamReader(response.GetResponseStream()))
result = reader.ReadToEnd();
}
return result;
}
}
}
Did this answer your question?