To create new assets through the API, you need to retrieve an access token. API documentation is here.
List of existing assets
Once you have an access token, you can list all your organizations assets:
curl -ivX 'GET' 'https://test-api.sirktek.com/assets/v1/asset?pageOffset=1&pageSize=25' -H 'accept: application/json' -H 'Authorization: Bearer eyJhbG...'
This will return a list of asset ids and names:
[{"id":1,"name":"name","tag":"000-123"}]
To get the full information set for an asset, see section below about how to retrieve asset by id.
Create a new asset
curl -X 'POST' \ 'https://test-api.sirktek.com/assets/v1/asset' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Test H05", "description": "This is a office chair of type H05", "categories": [ "H05" ] }' -H 'Authorization: Bearer eyJhbG...'
The response will include the new assets id and other information about the asset:
{"id":2,"name":"Test H05","description":"This is a office chair of type H05", ... }
Create new asset with external id/tag
It is possible to associate external tags (e.g. from QR-codes other than Sirk-Tek's own) to an asset when creating it:
curl -X 'POST' \ 'https://test-api.sirktek.com/assets/v1/asset' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "name": "Test 2 H05", "description": "This is also an office chair of type H05", "categories": [ "H05" ], "externalIds": [ { "systemName": "someSystem", "id": "abcde123" } ] }' -H 'Authorization: Bearer eyJhbG...'
Retrieve asset
Assets can be retrieved by id, by the (internal) tag, or by the associated external id.
Retrieve asset by id
curl -ivX 'GET' 'https://test-api.sirktek.com/assets/v1/asset/1' -H 'accept: application/json' -H 'Authorization: Bearer eyJhbG...'
Retrieve asset by tag
curl -ivX 'GET' 'https://test-api.sirktek.com/assets/v1/tag/000-123' -H 'accept: application/json' -H 'Authorization: Bearer eyJhbGc...'
Retrieve asset by external id/tag
curl -ivX 'GET' 'https://test-api.sirktek.com/assets/v1/tag/abcde123?externalSystem=someSystem' -H 'accept: application/json' -H 'Authorization: Bearer eyJh...'
All these three variants will return the same asset JSON representation.
Asset categories
When creating an asset you also can assign it to one or more categories. The categories are taken from SIRK:catalog, a taxonomy consisting of a hierarchy of inventory types (such as "sitting furniture" -> "chair" -> "office chair"), manufacturers, and models. A model will typically be linked to a manufacturer and an inventory type.
The catalog can be retrieved in JSON format from the /assets
If an asset is assigned to one category, the associated categories will be included in the asset's JSON representation (in the field 'connectedCategories'):
{
"id":1,
"name":"Test H05",
"tag":"001-36P",
"categories": ["H05"],
"connectedCategories":["Sitting furniture","Chair","Håg","Office chair"]
}
Var denne artikkelen nyttig?
Så bra!
Takk for din tilbakemelding
Beklager at vi ikke kunne være mer til hjelp
Takk for din tilbakemelding
Tilbakemeldingen er sendt inn
Vi setter pris på tilbakemeldingen din og vil prøve å rette på artikkelen