Asset Actor Messages
An Asset message is a method applied to an existing instance of an Asset. These are the available Asset messages:
| applyCommands | Applies a list of [Asset commands](/resources/actors/custom/asset/commands/) to a given `ASSET ID`. Commands are [batch processed](/resources/actors/#:~:text=Batch%20Processing%20of%20Commands,-Commands%20are%20always), which means that if one command fails, the entire message fails. |
| create | Creates a new instance of an asset actor. You must specify an asset type. If not, you'll get an [INVALID_MESSAGE_BODY](/resources/actors/errors/#:~:text=INVALID_MESSAGE_BODY-,INVALID_MESSAGE_BODY) error. |
| query | Queries the asset from the graph. |
Send Asset message requests using /resources/actors/custom/asset/<asset_id>``, where <asset_id> is new when creating a new instance.
Aside from the delete message, each time you send a message, the Asset returns all of its access URIs. They include:
- Default GUID
- Asset Number
- External Reference, if specified.
Therefore, you can also message an Asset with assetNumber or externalReference by including the assetType in the URL like so: /resources/actors/custom/asset/<ASSET TYPE>/<ASSET NUMBER OR EXTERNAL REFERENCE>.
Additionally, you can send multiple messages in one request or test them in preview mode.
A general template for Asset messages is:
json
[{
"type": "<MESSAGE TYPE>",
"body": {
}
}]Example: Create a new Vendor and add a localVendor item
Create a new `Vendor` and add a `localVendor` item
In this example, we will apply multiple messages at once to an Asset instance. We will create a Vendor Asset and immediately add a `localVendor` item to it. **Request** ```json [ { "type": "create", "body": { "typeKey": "vendor", "externalReference": "vendor100" } }, { "type": "applyCommands", "body": { "commands": [ { "type": "createItem", "itemTypeKey": "localVendor", "dynamic": { "distance": "close" } } ] } } ] ```