Assets
Manage Assets
The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$The page number to be retrieved where the size of the pages must be specified by the pageSize parameter. The number of the first page is 1.
1The number of documents being retrieved on the page.
60Fields to sort the response data by following the order of the parameters from left to right. Can contain multiple fields in the following format: field name:sort direction, separated by a comma. The colon preceding the sort direction parameter is optional, and the descending order is taken only if it is equal to desc or DESC. The ascending order is assumed in any other case.
name,metadata.createdAt:descA standard query parameter is used to search for specific values.
- Searching for items by string-based properties:
- By a field value:
q=access:PUBLIC, whereaccessis the field name, andPUBLICis its desired value.
- By a field value:
- Searching for items by a number-based property:
- With a specific value:
q=details.bytes:200 - With a value greater than:
q=details.bytes:>200 - With a value lower than:
q=details.bytes:<200 - With a value greater than or equal to:
q=details.bytes:>=200 - With a value lower than or equal to:
q=details.bytes:<=200 - With a value within a range of values:
q=details.bytes:(>=100 AND <=200), wheredetails.bytesis the name of a number-based field, and200is its querying value.
- With a specific value:
- Searching for items by a date-based property: All numer-based property queries are also valid for dates. In that case, the date should be placed within double quotes:
q=metadata.createdAt:(>="2021-05-18T07:27:27.455Z" AND <"2021-05-20T07:27:27.455Z") - Searching for items with a nonexistent or empty property:
q=details.filename:null, wheredetails.filenameis the field that has its value set tonull. - Searching for items with an existing property:
q=details:exists, wheredetailsis the field that has a non-empty value. - Searching for items by multiple specific values:
q=id:(5c3325baa9812100098ff48f,5c3325d1a9812100098ff494), whereidis the field name, and strings within the brackets are the desired values. - Searching for items by multiple fields:
q=id:5c3325baa9812100098ff48f access:PUBLIC, whereidandaccessare field names. All objects that contain the specified values are returned. Multiple fields (separated by spaces) can be specified. Multiple values for each field can also be specified in a format presented earlier. - Searching for items with string-based properties conforming to a regex:
q=id:~ABCD12orq=id:(~AB CD)- in the case of searching for strings with a space, whereidis the name of the field andABCD12orAB CDare its querying regular expressions.
name:{name}To get information how many entities meet the filtering requirements, the X-Total-Count header has been introduced. The header is optional and its default value is false. If the header is provided and it is set to true, then the total count is returned in the X-Total-Count response header. In both cases (X-Total-Count true, false or not provided), the response body has the same format (array of entities). This means that the information about the total count is returned only on demand, provided that the X-Total-Count header is present in a request.
falseResources have been retrieved successfully.
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
Internal Service Error occurred.
GET /media/{tenant}/assets HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
{
"id": "123e06ecf0452c2d6c0b81390",
"type": "BLOB",
"access": "PUBLIC",
"url": "https://api.emporix/tenant/id/download",
"details": {
"filename": "public.txt",
"mimeType": "text/plain"
},
"refIds": [
{
"id": "123e06ecf0452c2d6c0b81392",
"type": "CATEGORY"
}
],
"metadata": {
"createdAt": "2022-03-31T13:18:02.379Z",
"modifiedAt": "2022-03-31T13:18:02.379Z",
"version": 1
}
},
{
"id": "123e06ecf0452c2d6c0b81390",
"type": "LINK",
"access": "PUBLIC",
"url": "https://emporix.io/docs/index.html",
"metadata": {
"createdAt": "2022-03-31T13:18:02.379Z",
"modifiedAt": "2022-03-31T13:18:02.379Z",
"version": 1
},
"refIds": [
{
"id": "123e06ecf0452c2d6c0b81392",
"type": "CATEGORY"
}
]
}
]Creates a new asset for the tenant. An asset represents a digital (max 10MB) object in the system, for example a video, image, or a document.
To create an asset of the
BLOBtype, use themultipart/form-datarequest body.To create an asset of the
LINKtype, use theapplication/jsonrequest body.
Required scopes
media.asset_managemedia.asset_manage_by_vendor- allows to create an asset for products which belong to the vendor
The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$Content of the file. The max file size is 10MB.
Asset Json creation payload
The request was successful. The asset has been created.
Request was syntactically incorrect. Details will be provided in the response payload.
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
There are three possible reasons:
- Product with given code already exists, please choose unique code for your product
- Optimistic locking failed. If user sends metadata/version attribute which is outdated (someone else updated product in the time user was performing his changes). User should retrieve the latest product data and retry the request.
- Optimistic locking failed. User did not provide metadata/version attribute in update request, but someone else updated product while it was internally handled by product service. Resending the same request can result in successful update, but the update can override recently persisted changes.
Media request is too large.
Internal Service Error occurred.
POST /media/{tenant}/assets HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 317
{
"file": {
"externalValue": "https://res.cloudinary.com/saas-ag/image/upload/v1695804155/emporix-logo-white-2f5e621206edefea6015fb4793959376_nswfbz.png"
},
"body": {
"type": "BLOB",
"access": "PUBLIC",
"refIds": [
{
"id": "123e06ecf0452c2d6c0b81392",
"type": "CATEGORY"
}
],
"details": {
"filename": "theBestImage",
"mimeType": "image/jpg"
}
}
}{
"id": "53ac81fd0cce8b26b36f3492"
}The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$Unique identifier of an asset.
The request was successful. The requested asset is returned.
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The requested resource does not exist.
Internal Service Error occurred.
GET /media/{tenant}/assets/{assetId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
"id": "123e06ecf0452c2d6c0b81390",
"type": "LINK",
"access": "PUBLIC",
"url": "https://emporix.io/docs/index.html",
"refIds": [
{
"id": "123e06ecf0452c2d6c0b81392",
"type": "CATEGORY"
}
],
"metadata": {
"createdAt": "2022-03-31T13:18:02.379Z",
"modifiedAt": "2022-03-31T13:18:02.379Z",
"version": 1
}
}Updates a given asset. The type and access properties are immutable. Accepts files of up to 10MB.
To update an asset of the
BLOBtype, usemultipart/form-datarequest body.To update an asset of the
LINKtype, useapplication/jsonrequest body.
Required scopes
media.asset_managemedia.asset_manage_by_vendor- allows to update an asset which belong to the vendor
The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$Unique identifier of an asset.
Content of the file.
Asset Json update payload
The asset has been updated successfully.
No content
Request was syntactically incorrect. Details will be provided in the response payload.
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The requested resource does not exist.
There are three possible reasons:
- Product with given code already exists, please choose unique code for your product
- Optimistic locking failed. If user sends metadata/version attribute which is outdated (someone else updated product in the time user was performing his changes). User should retrieve the latest product data and retry the request.
- Optimistic locking failed. User did not provide metadata/version attribute in update request, but someone else updated product while it was internally handled by product service. Resending the same request can result in successful update, but the update can override recently persisted changes.
Media request is too large.
Internal Service Error occurred.
PUT /media/{tenant}/assets/{assetId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 342
{
"file": {
"externalValue": "https://res.cloudinary.com/saas-ag/image/upload/v1695804155/emporix-logo-white-2f5e621206edefea6015fb4793959376_nswfbz.png"
},
"body": {
"type": "BLOB",
"access": "PUBLIC",
"refIds": [
{
"id": "123e06ecf0452c2d6c0b81392",
"type": "CATEGORY"
}
],
"details": {
"filename": "theBestImage",
"mimeType": "image/jpg"
},
"metadata": {
"version": 1
}
}
}No content
The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$Unique identifier of an asset.
The asset has been deleted successfully.
No content
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
Internal Service Error occurred.
DELETE /media/{tenant}/assets/{assetId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
No content
The tenant that the caller is acting upon.
Note: The tenant name should always be written in lowercase.
^[a-z][a-z0-9]+$Unique identifier of an asset.
This is a successful response when requesting for a PRIVATE access asset of the BLOB type.
This is a successful response when requesting for a PUBLIC access asset.
Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.
Given authorization scopes are not sufficient and do not match scopes required by the endpoint.
The requested resource does not exist.
Internal Service Error occurred.
GET /media/{tenant}/assets/{assetId}/download HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
Ynl0ZXM=Was this helpful?

