Media API

Media File Management

Upload media file

Uploads a file to a specified media group associated with a given account. This is a multipart/form-data POST operation. Required parameters include 'account_id' and 'media_group_id'. Optional parameters include 'width', 'height', and 'maintain_aspect_ratio'. The JSON response representing the uploaded media asset.

post{hostname}/media

Path Query Arguments Example

{hostname}/media?account_id=23&height=22&maintain_aspect_ratio=true&media_group_id=17&width=1
Body:
{
"file": "File /* The binary media file to be uploaded. Should be included in the request body. Required. */"
}

API Request Parameters

NameTypeRequired FieldDescription
account_idintegerTrueThe numeric ID of the of the account
heightintegerFalseThe height of the media in pixels. Type: integer (int32). Should be included in the query string. Optional.
maintain_aspect_ratiobooleanFalseAspect ratio is the proportional relationship between an image's width and height as the image expands of shrinks
media_group_idintegerTrueThe ID of the media group to associate the uploaded file with. Type: integer (int64). Should be included in the query string. Required.
widthintegerFalseThe width of the media in pixels. Type: integer (int32). Should be included in the query string. Optional.

Get media binary by fileKey

Retrieves a file from the media storage using a unique file key. This is a GET operation. The output is a binary stream representing the file content.

Get media binary by mediaId

Retrieves a file from the media storage using a unique mediaId. This is a GET operation. The output is a binary stream representing the file content.

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media

Generate an image thumbnail

Generate image thumbnails with dimensions (in pixels) and aspect ratio.

post{hostname}/media/versions/thumbnail
Body:
{
"height": "200 # Type: integer",
"maintain_aspect_ratio": "false # Type: boolean",
"media_group_id": "113 # Type: integer",
"media_id": "23 # Type: integer",
"width": "200 # Type: integer"
}

API Request Parameters

NameTypeRequired FieldDescription
heightintegerTrueImage height (in pixels)
maintain_aspect_ratiobooleanFalseAspect ratio is the proportional relationship between an image's width and height as the image expands of shrinks
media_group_idintegerTrueIdentification of the media_group
media_idintegerTrueThe numeric ID of the of the media
widthintegerTrueImage width (in pixels)

Get the variations of media items by mediaId

Retrieves the variations (thumbnails, etc..) for a specific media item. This is a GET operation. The JSON response contains media properties such as path, MIME type, and dimensions.

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media

Get media object by Id

Retrieves metadata for a specific media item by its ID. This is a GET operation. The JSON response contains media properties such as path, MIME type, and dimensions.

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media

Delete media object

Deletes a media item identified by its ID. This is a DELETE operation. Returns HTTP 200 if successful, or 204 if the item is already removed.

Path Query Arguments Example

{hostname}/media/{media_id}?delete_all_media_versions=false

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media
delete_all_media_versionsbooleanFalseThis flag determines if a parent file (or media file) should be deleted including it's file variations