Skip to content

Message: asset.create

Back to Index

Creates a new instance of an asset actor.

You must specify an asset type. If not, you’ll get an INVALID_MESSAGE_BODY error.

Schema

Body
typeKeystring

Type of asset to create.

assetNumberstring (optional)

The AssetNumber to assign to the asset. If not set, the number is automatically generated.

commandsarray of command (optional)

An array of asset commands to be applied upon creation. If any command fails, the asset is not created.

externalReferencestring (optional)

Optional reference to add to the asset. All must be globally unique across all assets. It can be used to locate the actor with other means than assetID and assetNumber.

createdAtany value (optional)

Overrides createdAt value of the asset. If not set (or set to the future), the time will be set to the current system time of creation.

Response Type string

During the create message, these rule hooks are run in the given order:

  1. OnAssetBeforeCreated
  2. OnAssetCreated
  3. OnAssetCommands

Example: Create a new Vendor Asset

Create a New Vendor Asset

Send the following request to /resources/actors/asset/new

Request

POST https://<hantera-hostname>/resources/actors/asset/new
Authorization: Bearer <YOUR TOKEN>
Content-Type: application/json
[{
"type": "create",
"body": {
"typeKey": "vendor",
"externalReference": "vendorAsset"
}
}]

Response

HTTP/1.1 200 OK
---
{
"paths": [
"resources/actors/asset/019999f2-a2f0-70c9-a58e-36743f128fb5",
"resources/actors/asset/vendor/VE100001",
"resources/actors/asset/vendor/vendorAsset"
],
"data": {
"create": "OK"
}
}

Use new to automatically generate an asset id or manually apply a GUID of your choice. Applying an existing GUID returns an ALREADY_EXISTS error, and using a non-GUID returns a NOT_FOUND error.

Back to Index