Message: asset.create
Back to IndexCreates 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
typeKey | string Type of asset to create. |
assetNumber | string (optional) The AssetNumber to assign to the asset. If not set, the number is automatically generated. |
commands | array of command (optional) An array of asset commands to be applied upon creation. If any command fails, the asset is not created. |
externalReference | string (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 |
createdAt | any value (optional) Overrides |
Response Type
string
Related Rule Hooks
During the create message, these rule hooks are run in the given order:
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/newAuthorization: Bearer <YOUR TOKEN>Content-Type: application/json
[{ "type": "create", "body": { "typeKey": "vendor", "externalReference": "vendorAsset" }}]curl -i -X POST \ https://<hantera-hostname>/resources/actors/asset/new \ -H 'Authorization: Bearer <YOUR TOKEN>' \ -H 'Content-Type: application/json' \ -d '[{ "type": "create", "body": { "typeKey": "vendor", "externalReference": "vendorAsset" }}]'Invoke-WebRequest `-Uri "https://<hantera-hostname>/resources/actors/asset/new" `-Method POST `-Headers @{Authorization="Bearer <YOUR TOKEN>"; 'Content-Type'="application/json"} `-Body '[{ "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.