# Assets

Manage Assets

## Retrieving all assets

> Retrieves all assets assigned to the tenant. You can filter, sort, and paginate the results with query parameters.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_read","media.asset_manage","media.asset_read_by_vendor","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"parameters":{"trait_paged_pageNumber":{"name":"pageNumber","in":"query","description":"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.","schema":{"default":1,"minimum":1,"type":"integer"}},"trait_paged_pageSize":{"name":"pageSize","in":"query","description":"The number of documents being retrieved on the page.\n","schema":{"default":60,"minimum":1,"type":"integer"}},"trait_XTotalCount_header":{"in":"header","name":"X-Total-Count","required":false,"description":"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.","schema":{"default":false,"type":"boolean"}},"trait_sort":{"in":"query","name":"sort","required":false,"description":"Fields 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.","schema":{"type":"string"}},"query_q_product":{"name":"q","in":"query","description":"A standard query parameter is used to search for specific values.\n\n* Searching for items by string-based properties:\n  * By a field value: `q=access:PUBLIC`, where `access` is the field name, and `PUBLIC` is its desired value.\n* Searching for items by a number-based property:\n  * With a specific value: `q=details.bytes:200`\n  * With a value greater than: `q=details.bytes:>200`\n  * With a value lower than: `q=details.bytes:<200`\n  * With a value greater than or equal to: `q=details.bytes:>=200`\n  * With a value lower than or equal to: `q=details.bytes:<=200`\n  * With a value within a range of values: `q=details.bytes:(>=100 AND <=200)`, where `details.bytes` is the name of a number-based field, and `200` is its querying value.\n* 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\")`\n* Searching for items with a nonexistent or empty property: `q=details.filename:null`, where `details.filename` is the field that has its value set to `null`.\n* Searching for items with an existing property: `q=details:exists`, where `details` is the field that has a non-empty value.\n* Searching for items by multiple specific values: `q=id:(5c3325baa9812100098ff48f,5c3325d1a9812100098ff494)`, where `id` is the field name, and strings within the brackets are the desired values.\n* Searching for items by multiple fields: `q=id:5c3325baa9812100098ff48f access:PUBLIC`, where `id` and `access` are 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.\n* Searching for items with string-based properties conforming to a regex: `q=id:~ABCD12` or `q=id:(~AB CD)` - in the case of searching for strings with a space, where `id` is the name of the field and `ABCD12` or `AB CD` are its querying regular expressions.\n","schema":{"type":"string"}}},"responses":{"GetAssets":{"description":"Resources have been retrieved successfully.","content":{"application/json":{"schema":{"type":"array","description":"List of assets.","items":{"$ref":"#/components/schemas/GetAsset"}}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"GetAsset":{"title":"Get Asset","allOf":[{"$ref":"#/components/schemas/Asset"},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"type":{"type":"string","enum":["BLOB","LINK"],"description":"Asset type. This property is immutable."},"vendorId":{"type":"string","description":"Id of a vendor to which the asset belongs."},"url":{"type":"string","description":"Resource link."},"details":{"$ref":"#/components/schemas/AssetDetailsGet"},"metadata":{"$ref":"#/components/schemas/MetadataGet"}}}]},"Asset":{"title":"Asset","type":"object","properties":{"access":{"type":"string","enum":["PUBLIC","PRIVATE"],"description":"Access type of the asset. This property is immutable. \n- PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.\n- PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.\n"},"refIds":{"type":"array","description":"List of references.","items":{"$ref":"#/components/schemas/RefId"}}}},"RefId":{"type":"object","properties":{"type":{"type":"string","description":"Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.\n"},"id":{"type":"string","description":"Reference Id."}}},"AssetDetailsGet":{"title":"Asset Response Detailed Information","type":"object","allOf":[{"$ref":"#/components/schemas/AssetDetailsCreate"}],"properties":{"bytes":{"type":"number","description":"Size of the content associated with the asset in bytes."},"etag":{"type":"string","description":"The ETAG digest for the asset."}}},"AssetDetailsCreate":{"title":"Asset Request Detailed Information","type":"object","properties":{"filename":{"type":"string","description":"Asset filename."},"mimeType":{"type":"string","description":"The MIME (media) type of the asset."}}},"MetadataGet":{"type":"object","allOf":[{"$ref":"#/components/schemas/MetadataUpdate"}],"properties":{"createdAt":{"description":"Date and time when the document was created.","type":"string"},"modifiedAt":{"description":"Date and time when the document was last modified.","type":"string"}}},"MetadataUpdate":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Version of the document."}},"required":["version"]},"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}}},"paths":{"/media/{tenant}/assets":{"get":{"summary":"Retrieving all assets","description":"Retrieves all assets assigned to the tenant. You can filter, sort, and paginate the results with query parameters.","parameters":[{"$ref":"#/components/parameters/trait_paged_pageNumber"},{"$ref":"#/components/parameters/trait_paged_pageSize"},{"$ref":"#/components/parameters/trait_XTotalCount_header"},{"$ref":"#/components/parameters/trait_sort"},{"$ref":"#/components/parameters/query_q_product"}],"responses":{"200":{"$ref":"#/components/responses/GetAssets"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"GET-media-list-assets","tags":["Assets"]}}}}
```

## Creating an asset

> 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 \`BLOB\` type, use the \`multipart/form-data\` request body. \
> \- To create an asset of the \`LINK\` type, use the \`application/json\` request body.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_manage","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"schemas":{"AssetCreateMultipart":{"title":"Asset Create Multipart Payload","type":"object","properties":{"file":{"type":"object","format":"binary","description":"Content of the file. The max file size is 10MB."},"body":{"description":"Asset JSON creation payload.","allOf":[{"$ref":"#/components/schemas/AssetCreateBlob"}]}},"required":["file","body"]},"AssetCreateBlob":{"title":"Asset Create Blob Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"type":{"type":"string","enum":["BLOB"],"description":"Asset type. This property is immutable."},"details":{"$ref":"#/components/schemas/AssetDetailsCreate"}},"required":["type","access"]},"Asset":{"title":"Asset","type":"object","properties":{"access":{"type":"string","enum":["PUBLIC","PRIVATE"],"description":"Access type of the asset. This property is immutable. \n- PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.\n- PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.\n"},"refIds":{"type":"array","description":"List of references.","items":{"$ref":"#/components/schemas/RefId"}}}},"RefId":{"type":"object","properties":{"type":{"type":"string","description":"Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.\n"},"id":{"type":"string","description":"Reference Id."}}},"AssetDetailsCreate":{"title":"Asset Request Detailed Information","type":"object","properties":{"filename":{"type":"string","description":"Asset filename."},"mimeType":{"type":"string","description":"The MIME (media) type of the asset."}}},"AssetCreateLink":{"title":"Asset Create Link Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"type":{"type":"string","enum":["LINK"],"description":"Asset type. This property is immutable."},"url":{"type":"string","description":"Resource link."}},"required":["type","access","url"]},"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}},"responses":{"BadRequest_400":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Conflict_409":{"description":"There are three possible reasons:\n1. Product with given code already exists, please choose unique code for your product\n2. 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.\n3. 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.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"RequestTooLarge_413":{"description":"Media request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/media/{tenant}/assets":{"post":{"summary":"Creating an asset","description":"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.\n- To create an asset of the `BLOB` type, use the `multipart/form-data` request body. \n- To create an asset of the `LINK` type, use the `application/json` request body.","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/AssetCreateMultipart"}},"application/json":{"schema":{"$ref":"#/components/schemas/AssetCreateLink"}}}},"responses":{"201":{"description":"The request was successful. The asset has been created.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest_400"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"409":{"$ref":"#/components/responses/Conflict_409"},"413":{"$ref":"#/components/responses/RequestTooLarge_413"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"POST-media-create-asset","tags":["Assets"]}}}}
```

## Retrieving an asset

> Retrieves an asset by its unique identifier.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_read","media.asset_read_by_vendor","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"responses":{"GetAsset":{"description":"The request was successful. The requested asset is returned.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/GetAssetBlob"},{"$ref":"#/components/schemas/GetAssetLink"}]}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"NotFound_404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"GetAssetBlob":{"title":"Get Asset Blob","type":"object","allOf":[{"$ref":"#/components/schemas/AssetCreateBlob"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"vendorId":{"type":"string","description":"Id of a vendor to which the asset belongs."},"details":{"$ref":"#/components/schemas/AssetDetailsGet"},"metadata":{"$ref":"#/components/schemas/MetadataGet"}}},"AssetCreateBlob":{"title":"Asset Create Blob Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"type":{"type":"string","enum":["BLOB"],"description":"Asset type. This property is immutable."},"details":{"$ref":"#/components/schemas/AssetDetailsCreate"}},"required":["type","access"]},"Asset":{"title":"Asset","type":"object","properties":{"access":{"type":"string","enum":["PUBLIC","PRIVATE"],"description":"Access type of the asset. This property is immutable. \n- PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.\n- PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.\n"},"refIds":{"type":"array","description":"List of references.","items":{"$ref":"#/components/schemas/RefId"}}}},"RefId":{"type":"object","properties":{"type":{"type":"string","description":"Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.\n"},"id":{"type":"string","description":"Reference Id."}}},"AssetDetailsCreate":{"title":"Asset Request Detailed Information","type":"object","properties":{"filename":{"type":"string","description":"Asset filename."},"mimeType":{"type":"string","description":"The MIME (media) type of the asset."}}},"AssetDetailsGet":{"title":"Asset Response Detailed Information","type":"object","allOf":[{"$ref":"#/components/schemas/AssetDetailsCreate"}],"properties":{"bytes":{"type":"number","description":"Size of the content associated with the asset in bytes."},"etag":{"type":"string","description":"The ETAG digest for the asset."}}},"MetadataGet":{"type":"object","allOf":[{"$ref":"#/components/schemas/MetadataUpdate"}],"properties":{"createdAt":{"description":"Date and time when the document was created.","type":"string"},"modifiedAt":{"description":"Date and time when the document was last modified.","type":"string"}}},"MetadataUpdate":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Version of the document."}},"required":["version"]},"GetAssetLink":{"title":"Get Asset Link","type":"object","allOf":[{"$ref":"#/components/schemas/AssetCreateLink"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"vendorId":{"type":"string","description":"Id of a vendor to which the asset belongs."},"metadata":{"$ref":"#/components/schemas/MetadataGet"}}},"AssetCreateLink":{"title":"Asset Create Link Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"id":{"type":"string","description":"Unique identifier of an asset."},"type":{"type":"string","enum":["LINK"],"description":"Asset type. This property is immutable."},"url":{"type":"string","description":"Resource link."}},"required":["type","access","url"]},"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}}},"paths":{"/media/{tenant}/assets/{assetId}":{"get":{"summary":"Retrieving an asset","description":"Retrieves an asset by its unique identifier.","responses":{"200":{"$ref":"#/components/responses/GetAsset"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"404":{"$ref":"#/components/responses/NotFound_404"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"GET-media-retrieve-asset","tags":["Assets"]}}}}
```

## Updating an asset

> Updates a given asset. The \`type\` and \`access\` properties are immutable. Accepts files of up to 10MB.\
> \- To update an asset of the \`BLOB\` type, use \`multipart/form-data\` request body. \
> \- To update an asset of the \`LINK\` type, use \`application/json\` request body.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_manage","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"schemas":{"AssetUpdateMultipart":{"title":"Asset Update Mutlipart Payload","type":"object","properties":{"file":{"type":"object","format":"binary","description":"Content of the file."},"body":{"description":"Asset Json update payload","allOf":[{"$ref":"#/components/schemas/AssetUpdateBlob"}]}},"required":["file","body"]},"AssetUpdateBlob":{"title":"Asset Update Blob Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"type":{"type":"string","enum":["BLOB"],"description":"Asset type. This property is immutable."},"details":{"$ref":"#/components/schemas/AssetDetailsCreate"},"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}},"required":["access","type"]},"Asset":{"title":"Asset","type":"object","properties":{"access":{"type":"string","enum":["PUBLIC","PRIVATE"],"description":"Access type of the asset. This property is immutable. \n- PUBLIC: Assets will be stored by a public storage provider and will be accessible at an external link.\n- PRIVATE: Assets will be stored by a private storage provider and will not be accessible at an external url. Assets of the `PRIVATE` type can only be accessed by calling the `media/{tenant}/assets/{assetId}/download` endpoint in the Media Service.\n"},"refIds":{"type":"array","description":"List of references.","items":{"$ref":"#/components/schemas/RefId"}}}},"RefId":{"type":"object","properties":{"type":{"type":"string","description":"Reference type. Can be one of the predefined types: `BRAND`, `CATEGORY`, `LABEL`, `PRODUCT`, `MODULE` or any custom schema type.\n"},"id":{"type":"string","description":"Reference Id."}}},"AssetDetailsCreate":{"title":"Asset Request Detailed Information","type":"object","properties":{"filename":{"type":"string","description":"Asset filename."},"mimeType":{"type":"string","description":"The MIME (media) type of the asset."}}},"MetadataUpdate":{"type":"object","properties":{"version":{"minimum":1,"type":"integer","description":"Version of the document."}},"required":["version"]},"AssetUpdateLink":{"title":"Asset Update Link Payload","type":"object","allOf":[{"$ref":"#/components/schemas/Asset"}],"properties":{"url":{"type":"string","description":"Resource link."},"type":{"type":"string","enum":["LINK"],"description":"Asset type. This property is immutable."},"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}},"required":["access","url","type"]},"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}},"responses":{"BadRequest_400_Update":{"description":"Request was syntactically incorrect. Details will be provided in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"NotFound_404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"Conflict_409":{"description":"There are three possible reasons:\n1. Product with given code already exists, please choose unique code for your product\n2. 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.\n3. 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.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"RequestTooLarge_413":{"description":"Media request is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/media/{tenant}/assets/{assetId}":{"put":{"summary":"Updating an asset","description":"Updates a given asset. The `type` and `access` properties are immutable. Accepts files of up to 10MB.\n- To update an asset of the `BLOB` type, use `multipart/form-data` request body. \n- To update an asset of the `LINK` type, use `application/json` request body.","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/AssetUpdateMultipart"}},"application/json":{"schema":{"$ref":"#/components/schemas/AssetUpdateLink"}}}},"responses":{"204":{"description":"The asset has been updated successfully."},"400":{"$ref":"#/components/responses/BadRequest_400_Update"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"404":{"$ref":"#/components/responses/NotFound_404"},"409":{"$ref":"#/components/responses/Conflict_409"},"413":{"$ref":"#/components/responses/RequestTooLarge_413"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"PUT-media-update-asset","tags":["Assets"]}}}}
```

## Deleting an asset

> Deletes an asset.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_manage","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"responses":{"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}}},"paths":{"/media/{tenant}/assets/{assetId}":{"delete":{"summary":"Deleting an asset","description":"Deletes an asset.","responses":{"204":{"description":"The asset has been deleted successfully."},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"DELETE-media-remove-asset","tags":["Assets"]}}}}
```

## Downloading an asset

> Downloads an asset by its unique identifier.

```json
{"openapi":"3.0.0","info":{"title":"Media Service","version":"0.0.1"},"tags":[{"name":"Assets","description":"Manage Assets"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["media.asset_read","media.asset_read_by_vendor","media.asset_manage_by_vendor"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"media.asset_read":"Needed to read assets","media.asset_manage":"Needed to manage assets"}}}}},"responses":{"GetPrivateAsset":{"description":"This is a successful response when requesting a PRIVATE BLOB asset.","content":{"text/plain":{"schema":{"type":"string","format":"byte"}}},"headers":{"ETag":{"schema":{"type":"string"},"description":"Version identifier of the resource, necessary for caching."}}},"Redirect":{"description":"This is a successful response when requesting for a PUBLIC access asset.","headers":{"Location":{"schema":{"type":"string"},"description":"Url address of the requested file."}}},"Unauthorized_401":{"description":"Given request is unauthorized - the authorization token is invalid or has expired. Details will be provided in the response payload.","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Forbidden_403":{"description":"Given authorization scopes are not sufficient and do not match scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"NotFound_404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"InternalServiceError_500":{"description":"Internal Service Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"title":"Error","description":"Schema for specific API errors.","type":"object","properties":{"code":{"type":"integer","description":"HTTP status code.","minimum":100,"maximum":599},"status":{"description":"HTTP status.","type":"string"},"message":{"description":"Descriptive error message for debugging.","type":"string"},"details":{"description":"List of problems causing this error.","type":"array","items":{"title":"Error Detail","description":"Error details.","type":"string"}},"resourceId":{"description":"Id of the resource.","type":"string"}},"required":["status","code","message"]}}},"paths":{"/media/{tenant}/assets/{assetId}/download":{"get":{"summary":"Downloading an asset","description":"Downloads an asset by its unique identifier.","responses":{"200":{"$ref":"#/components/responses/GetPrivateAsset"},"301":{"$ref":"#/components/responses/Redirect"},"401":{"$ref":"#/components/responses/Unauthorized_401"},"403":{"$ref":"#/components/responses/Forbidden_403"},"404":{"$ref":"#/components/responses/NotFound_404"},"500":{"$ref":"#/components/responses/InternalServiceError_500"}},"operationId":"GET-media-download-asset","tags":["Assets"]}}}}
```
