The Add Asset API allows you to add an asset, with or without attrubutes to a ZetaSafe client.
A valid x-Auth-token header, belonging to the user adding the asset is required.
URI
Development
Production
Method
POST
Content Type
application/json
Body
Required Fields: assetTypeId, locationId. Any other fields are optional.
{"assetTypeId":###, "locationId":###}
Example:
{"assetTypeId":19394876, "locationId":1004009726}
All Fields Example
{
"assetTypeId":19394876,
"locationId":1004009726,
"assetIdentifier":"Primary Identifier",
"assetStatus":0,
"barcode":"barcode",
"rfid":"rfid",
"name":"Secondary Identifier",
"riskRating":1,
"longitude":"long",
"latitude":"lat",
"altitude":"altitude",
"groupCode1":"Code 1",
"groupCode2":"Code 2",
"assetDescription":"Description",
"attributes":{"1021153682":"text","1021153683":"2019-04-25","1021153684":"23"}
}
The possible values for assetStatus are Active - 0, Temporarily Suspended - 1, Not Active - 2. The field defaults to Active if not included in the request.
The attributes field is a map of String - String pairs. The first being the attribute definition id and the second being the value of the attribute. In the case of a date attribute the date format is YYYY-MM-DD.
Responses:
201: Created - the record id returned
{"recordId":1021156388}
This successful response is the ZetaSafe location PK (Primary Key). This can be used for any additional related data which is required such ass assets or publications.
400: Bad Request - an explanation is returned
{"result":"FOREIGN_KEY_INVALID",
"headings":[{"key":"ok","value":"OK"}],
"title":"Record not found",
"message":"The Location with an ID value of 2004009726 could not be found."}
403: Unauthorised/Access Denied
{
"timestamp": 1556533789103,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.NullPointerException",
"message": "No message available",
"path": "//v1/location/handheld/add"
}
409: Conflict - The Asset Licences for the client have been exceeded
{"result":"LICENCE_EXCEEDED",
"headings":[{"key":"licenceExceededRequestMore","value":"Request more licenses"},
{"key":"ok","value":"OK"}],
"title":"Licence exceeded",
"message":"You do not have sufficient licences available to add a new asset. Demo iOS has available 0 Asset licences"}
409: Duplicate Entries
This may occur if you attempt to add an asset to ZetaSafe which contains a barcode which is already assigned to another asset within the same Client.
415: Unsupported Media Type - The value of an attribute field did not match the intended value described in the definition.
{"result":"UNEXPECTED_DATA_TYPE",
"headings":[{"key":"ok","value":"OK"}],
"title":"Unexpected data type",
"message":"The entry in Attribute 3 Attribute Value was expected to be in number format. Please check your Attribute 3 Attribute Value entry and try again."}
500: Error with the internal process of adding an asset.