Use this endpoint to create an asset. There are two ways to use this endpoint. The first method is to create a resource separately, then provide the resource id in the json body of the request along with any other desired data. The second method is to provide resource binary as a multipart field. Another multipart field containing any additional data can then be optionally provided. The second method allows the asset and resource to be created simultaneously. Note:- If AI tag analysis is enabled, it starts in the background. AI analyzes and provides tag recommendations for the asset that is created.
Method 1 (Create asset and resource separately):
Create the resource
See POST /resource for details on how to create a resource.
Create the asset
Create an asset by providing the resource id obtained from the previous step. Additional data about the asset can also be optionally provided. If an asset exists in the specified path, it is overwritten. The path that you provide must contain a leading slash. The path and name fields are optional and are generated from the resource’s name by default.
Example request body:
{
"resource": "8d21025d21e7b3595cbf630fb9d7212b",
"path": "/Screen Shot 2016-05-11 at 6.52.22 PM",
"description": "Screenshot",
"name": "Important screenshot",
"tags": {
"values": [
"screenshot"
]
},
"status": "draft"
}
Method 2 (Create asset and resource simultaneously):
Set the Content-Type header
Set the Content-Type header to 'multipart/form-data'.
Set the 'resource' field on the multipart form
The resource field on the multipart form should contain your resource binary. The following headers are required on this form part:
- Content-Type header specifying the format of the resource.
- The filename field on the Content-Disposition header of this form part specifying the resource name.
Set the 'data' field on the multipart form (optional)
Additional data about the asset can be optionally provided. If an asset exists in the specified path, it is overwritten. The path that you provide must contain a leading slash. The path and name fields are optional and are generated from the resource’s name by default.
Example value in field:
{
"path": "/Screen Shot 2016-05-11 at 6.52.22 PM",
"description": "Screenshot",
"name": "Important screenshot",
"tags": {
"values": [
"screenshot"
]
},
"status": "draft"
}
Create the asset and resource
Create the asset and resource simultaneously by posting the form.
User roles: admin, manager, editor