Trail Asset Management API
This is the API documentation of Trail API.
Authentication
To use this API you have to get an API Token from the Trail service. Once you have the token, you can access the services below by adding the token into the request header:
Authorization: Basic <YOUR API TOKEN>
curl -H "Content-Type: application/json" -H "Authorization: Basic <YOUR API TOKEN>" https://guest.trail.fi/api/v1/items
Getting the Api key
Request the API key from your Trail administrator, or contact our support support@trail.fi.
Items ¶
Items ¶
Get ItemsGET/items{?search,page,per_page}
Get a list of items.
Example URI
- search
array
(optional)Search parameters
- For example
search[free]=akg
- For example
- page
integer
(optional) Example: 1Page number
- per_page
integer
(optional) Example: 50Number of results per page
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 39,
"identity": "I100115",
"model": "Akg C414B-XLS",
"category": "Microphones",
"department": null,
"serial": "10341",
"created_at": "2019-01-04T14:52:21Z",
"updated_at": "2019-01-04T14:52:21Z",
"location": {
"location": {
"id": 2,
"code": "1001",
"name": "Main Stage"
}
}
}
],
"metadata": {
"page": 1,
"total_pages": 1,
"per_page": 50,
"total_entries": 4,
"order_by": null,
"order_direction": null
}
}
Create New ItemPOST/items
Create a new item using a title and an optional content body.
Example URI
Headers
Content-Type: application/json
Body
{
"department": "Target department name",
"category": "Model category name",
"manufacturer": "Manufacturer name",
"model": "Model name",
"location": {
"type": "location",
"identity": "Location identity"
},
"serial": "",
"current_user": "",
"width": "",
"length": "",
"height": ""
}
201
401
Headers
Content-Type: application/json
Body
{
"errors": [
"authentication.api_key.user.no_privileges"
]
}
Item ¶
Item description
Get ItemGET/items/{id}
Get a single item.
Example URI
- id
string
(required) Example: I100115The item id or identity.
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 39,
"identity": "I100115",
"model": "Akg C414B-XLS",
"category": "Microphones",
"department": null,
"serial": "10341",
"created_at": "2019-01-04T14:52:21Z",
"updated_at": "2019-01-04T14:52:21Z",
"location": {
"location": {
"id": 2,
"code": "1001",
"name": "Main Stage"
}
}
}
}
400
Headers
Content-Type: application/json
Body
{
"errors": [
"api.v1.items.not_found"
]
}
Update a ItemPUT/items/{id}
Example URI
- id
string
(required) Example: I100115The item id or identity.
Headers
Content-Type: application/json
Body
{
"department": "Target department name",
"category": "Model category name",
"manufacturer": "Manufacturer name",
"model": "Model name",
"location": {
"type": "location",
"identity": "Location identity"
},
"serial": "",
"current_user": "",
"width": "",
"length": "",
"height": ""
}
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 39,
"identity": "I100115",
"model": "Akg C414B-XLS",
"category": "Microphones",
"department": null,
"serial": "10341",
"created_at": "2019-01-04T14:52:21Z",
"updated_at": "2019-01-04T14:52:21Z",
"location": {
"location": {
"id": 2,
"code": "1001",
"name": "Main Stage"
}
}
}
}
404
Headers
Content-Type: application/json
Body
{
"errors": [
"api.v1.items.invalid_request"
]
}
Delete a ItemDELETE/items/{id}
Delete a single item
Example URI
- id
string
(required) Example: I100115The item id or identity.
200
404
Headers
Content-Type: application/json
Body
{
"errors": [
"authentication.api_key.user.no_privileges"
]
}
Locations ¶
Group of all location-related resources.
Locations ¶
Get LocationsGET/locations{?search,page,per_page}
Get a list of locations.
Example URI
- search
array
(optional)Search parameters
- For example
search[free]=warehouse
- For example
- page
integer
(required) Example: 1Page number
- per_page
integer
(required) Example: 50Number of results per page
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"identity": "L100007",
"code": "K2001",
"name": "Warehouse",
"description": null,
"ancestry": null
}
],
"metadata": {
"page": 1,
"total_pages": 1,
"per_page": 50,
"total_entries": 4,
"order_by": null,
"order_direction": null
}
}
Departments ¶
Group of all departments accessible for the user.
Departments ¶
Get DepartmentsGET/departments
Get a list of departments.
Example URI
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"identity": "L100007",
"code": "K2001",
"name": "Warehouse",
"description": null,
"ancestry": null,
"created_at": "2019-01-27T14:57:29+02:00",
"updated_at": "2019-01-27T14:57:29+02:00"
}
],
"metadata": {
"page": 1,
"total_pages": 1,
"per_page": 50,
"total_entries": 4,
"order_by": null,
"order_direction": null
}
}
Models ¶
Group of all model-related resources.
Models ¶
Get ModelsGET/models{?search,page,per_page}
Get a list of models.
Example URI
- search
array
(optional)Search parameters
- For example
search[free]=warehouse
- For example
- page
integer
(required) Example: 1Page number
- per_page
integer
(required) Example: 50Number of results per page
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"identity": "M100008",
"manufacturer": "Manufacturer name",
"name": "Model name",
"description": null
}
],
"metadata": {
"page": 1,
"total_pages": 1,
"per_page": 50,
"total_entries": 4,
"order_by": null,
"order_direction": null
}
}
Categories ¶
Group of all category-related resources.
Categories ¶
Get CategoriesGET/categories{?search,page,per_page}
Get a list of categories.
Example URI
- search
array
(optional)Search parameters
- For example
search[free]=microphones
- For example
- page
integer
(required) Example: 1Page number
- per_page
integer
(required) Example: 50Number of results per page
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1,
"identity": "L100007",
"code": "K2001",
"name": "Warehouse",
"description": null,
"ancestry": null,
"created_at": "2019-01-27T14:57:29+02:00",
"updated_at": "2019-01-27T14:57:29+02:00"
}
],
"metadata": {
"page": 1,
"total_pages": 1,
"per_page": 50,
"total_entries": 4,
"order_by": null,
"order_direction": null
}
}