Asset

Assets and their types

The Asset object

What an asset represents varies upon your business needs. Typical examples include

  • machinery for rental,
  • facilities or property for maintenance,
  • vehicles for keeping track of service.

The common denominator is that an asset typically represents a "thing of value". They can have a state, location and contact person, and they can also be coupled to a customer and project.

Most importantly, jobs can be created "on an asset" (using the assetUuid property), enabling you to track job history on an asset, e.g. service history on a machine or facility. See the section on listing jobs by asset (GET /job/list/asset/:assetid).

Example


			

States

Assets can have states, which are typically used for rental purposes. They are shown in the mobile and web applications as text and colors. Usage of states is optional, so the state can also be null.

Asset States

DRAFT, PROCURED, PREPARATION, REPAIR, AVAILABLE, RESERVED, PROVISIONING, IN_USE, UNPROVISIONING, OUT_OF_ORDER, DISCARDED

Get assets

Get all assets

Query Parameters

inactive If supplied, inactive assets will be included
limit Limit the number of returned objects Integer
offset Skip the first N objects Integer
modified Include only objects modified since this date/timestamp Timestamp 2015-10-05

Example

GET /asset
Response

List of asset objects.

Method
GET
URL
/asset
Authentication
Token
Response
List of Asset

Get an asset

Get a specific asset by ID or UUID

Example

GET /asset/2039077
Response

An asset object.

Method
GET
URL
/asset/:id
Authentication
Token
Response
Asset object

Create an asset

Create an asset. The asset will be assigned a server-generated ID and UUID.

Example

POST /asset
{
	"assetNo": "123",
	"name": "Giant meat grinder"
}
Response

The created asset object.

Method
POST
URL
/asset
Authentication
Token
Request
Asset object
Response
Asset object

Update or create an asset

Update an existing asset or create it (if it doesn't exist and :id is a UUID).

Example

PUT /asset/0847ed17-b060-4599-a38c-be9a8b9cbb34
{
	"assetNo": "123",
	"name": "Giant meat grinder"
}
Response

The updated asset object.

Method
PUT
URL
/asset/:id
Authentication
Token
Request
Asset object
Response
Asset object

Delete an asset

Delete an asset.

Example

DELETE /asset/0847ed17-b060-4599-a38c-be9a8b9cbb34
Method
DELETE
URL
/asset/:id
Authentication
Token
Response
Status code only

Additional content

Upload and attach a document to an asset

This operation is divided into two or (optionally) three requests:

  1. Upload the document content (i.e. an image or PDF file),
  2. (Optional) Update the document meta data (i.e. description),
  3. Attach the document to the asset.

1. Upload the document content

The actual document content (the image, PDF file or whatever) is uploaded using a standard (multipart/form-data) file upload using file as the form parameter name.

POST /document/content
Content-type: multipart/form-data

Example using curl

curl -i 'https://app.coredination.net/api/1/document/content' \
	-H 'API-Key: {my-api-key}' \
	-F file=@myimage.jpg

HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Content-Type: application/json
{
  "success": true,
  "document": {
    "uuid": "8acac590-cc94-45aa-a237-18a9d268f431",
    "thumbUrl": "/vault/thumbnail/8acac590-cc94-45aa-a237-18a9d268f431",
    "size": 7911,
    "mimeType": "image/jpeg",
    "lastModified": 1447890986622,
    "contentUrl": "/vault/document/8acac590-cc94-45aa-a237-18a9d268f431",
    "creationTimeStamp": 1447890986484,
    "creatorId": null,
    "description": null,
    "fileName": "myimage.jpg",
    "groupId": 17,
    "id": 26174165,
    "internal": false
  }
}

The response should contain the success flag set to true, indicating that the upload and backend storage was successful. It also contains the Document (meta data entity) itself, which you later need to refer to, so hang on to its UUID from here on.

Method
POST
URL
/document/content
Authentication
Token
Response
Upload DTO

2. (Optional) Update the document meta data

If you want to change any of the meta data (i.e. description, filename, the internal flag) of the document, you can update it using a PUT request:

Example

PUT /document/8acac590-cc94-45aa-a237-18a9d268f431
Content-type: application/json
{
	"description": "Top secret map of asset site",
	"internal": true
}

The response will contain the updated document (meta data).

Method
PUT
URL
/document/:did
Authentication
Token
Response
Document object

3. Attach the document to the asset

Attaching the document is a simple PUT request without content.

Example

PUT /asset/cbfc4b6f-ee81-4591-8e88-fd359cb2f967/document/8acac590-cc94-45aa-a237-18a9d268f431

The response has no content and should just return status code 200 (OK).

Method
PUT
URL
/asset/:id/document/:did
Authentication
Token
Response
Status code only

Detach a document from an asset

Detaching a document from an asset is a simple DELETE request without content.

Example

DELETE /asset/cbfc4b6f-ee81-4591-8e88-fd359cb2f967/document/8acac590-cc94-45aa-a237-18a9d268f431

The response has no content and should just return status code 200 (OK).

Method
DELETE
URL
/asset/:id/document/:did
Authentication
Token
Response
Status code only

Asset types

The AssetType object

An asset type is essentially just an ID/UUID with the typical creator/group properties, plus a name and a template for creating assets of that type.

Example


			

Get asset types

Get all asset types

Example

GET /asset/type
Response

List of asset type objects.

Method
GET
URL
/asset/type
Authentication
Token
Response
List of AssetType

Get an asset type

Get a specific asset type by ID or UUID

Example

GET /asset/type/2039077
Response

An asset type object.

Method
GET
URL
/asset/type/:id
Authentication
Token
Response
AssetType object

Create an asset type

Create an asset type. The asset type will be assigned a server-generated ID and UUID.

Example

POST /asset/type
{
	"name": "Meat grinder",
	"assetTemplate": {
		// ...
	}
}
Response

The created asset type object.

Method
POST
URL
/asset/type
Authentication
Token
Request
AssetType object
Response
AssetType object

Update or create an asset type

Update an existing asset type or create it (if it doesn't exist and :id is a UUID).

Example

PUT /asset/type/0847ed17-b060-4599-a38c-be9a8b9cbb34
{
	"name": "Meat grinder",
	"assetTemplate": {
		// ...
	}
}
Response

The updated asset type object.

Method
PUT
URL
/asset/type/:id
Authentication
Token
Request
AssetType object
Response
AssetType object

Delete an asset type

Delete an asset type.

Example

DELETE /asset/type/0847ed17-b060-4599-a38c-be9a8b9cbb34
Method
DELETE
URL
/asset/type/:id
Authentication
Token
Response
Status code only