updateMediaItem
put
/ccadmin/v1/files/mediaContents
Update Media Item. Rename a media item. Optionally takes the x-ccasset-language header to get translated content in another language.
Request
Supported Media Types
- application/json
Header Parameters
- X-CCAsset-Language
-
Type:
stringThe asset language of the request
Body Parameter
Root Schema : updateMediaItem_request
{
"metadata":{
"altText":"altText",
"titleText":"titleText"
},
"destinationFileName":"prod10001.jpg",
"uploadType":"productImage",
"overwrite":true,
"sourcePath":"/products/prod123.jpg"
}
- destinationFileName
-
Type:
stringRequired:trueNew filename of media item. - metadata
-
Type:
objectmetadataAdditional Properties Allowed:Seo meta info for product. - overwrite
-
Type:
booleanIf true, an existing file will be overwritten if it has the same name as the destination file. - sourcePath
-
Type:
stringRequired:truePath of media item to rename. - uploadType
-
Type:
stringAn uploadtype which has an associating postprocessor, if renaming should trigger assignment.
Nested Schema : metadata
Type:
objectSeo meta info for product.
- altText
-
Type:
stringThe alt text for the media item. - titleText
-
Type:
stringThe title text for the media item.
Response
Supported Media Types
- application/json
200 Response
Following model is returned when operation succeeds.
Body
Root Schema : updateMediaItem_response
- assignResult
-
Type:
objectassignResultAdditional Properties Allowed:The assignment result. - renameSuccess
-
Type:
booleanTrue if the file was renamed successfully, false if not.
Nested Schema : assignResult
Type:
objectThe assignment result.
- itemID
-
Type:
stringItem ID for assignment, based on naming convention - itemType
-
Type:
stringThe type of item for assignment, based on the upload type. - statusCode
-
Type:
stringStatus code of assignment. One of: ASSIGNED, ALREADY_ASSIGNED, ITEM_NOT_FOUND, TYPE_NOT_SUPPORTED, UPLOAD_FAILED, OTHER_ERROR
Example application/json
{
"assignResult":{
"itemID":"prod10001",
"itemType":"product",
"statusCode":"ASSIGNED"
},
"renameSuccess":true
}
Default Response
The error response.
The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud:
|Error Code|Description|
|------------------|------------------|
|33130|The destination filename must contain a base name.|
|33120|The destination file name cannot contain a path.|
|33131|The file to update metadata does not exist.|
|33117|The file to rename does not exist.|
|33128|The file extension was not allowed for upload, or did not match the file contents.|
|33125|The sourcePath parameter is required.|
|33123|The filename must be 254 characters or less, and the following characters are not allowed in the filename: \ : " * < > ? | Please enter a different name.|
|33124|The file cannot be renamed because the source file and the destination file are the same.|
|33121|A file with this name exists in the folder. Please enter a different name.|
|33132|The file to update metadata is not a file.|
|33122|The destinationFileName param is required.|
|33133|The file to update metadata is not a media file.|
|33118|The file to rename is not a file.|
|33129|There was an error while validating the file extension.|
|33119|The file to rename is not a media file.|
Body
Root Schema : errorModel
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - errors
-
Type:
arrayerrorsAdditional Properties Allowed:An optional list of errors if multiple errors were encountered - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code - type
-
Type:
stringThe URI to the HTTP state code definition
Nested Schema : errors
Nested Schema : items
Type:
object- devMessage
-
Type:
stringAn optional non-localized message containing technical information for developers - errorCode
-
Type:
stringThe numerical code identifying the error - message
-
Type:
stringThe localized message describing the error - moreInfo
-
Type:
stringAn optional non-localized message with more information - o:errorPath
-
Type:
stringAn optional machine readable description of where the error occurred - status
-
Type:
stringThe HTTP status code
Examples
Sample Request:
{
"metadata": {
"altText": "altText",
"titleText": "titleText"
},
"destinationFileName": "prod10001.jpg",
"uploadType": "productImage",
"overwrite": true,
"sourcePath": "/products/prod123.jpg"
}
Sample Response Payload returned by endpoint:
{
"assignResult": {
"itemID": "prod10001",
"itemType": "product",
"statusCode": "ASSIGNED"
},
"renameSuccess": true
}