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{host_name}/media

Path Query Arguments Example

{host_name}/media?account_id=21&height=12&maintain_aspect_ratio=false&media_group_id=17&width=19
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.

Rename the media file's name

Change the name of a file/media.

Body:
{
"file_name": "Complex_Challenges.pdf",
"media_id": 23
}

API Request Parameters

NameTypeRequired FieldDescription
file_namestringTrue File Name of the media
media_idintegerTrueThe numeric ID of the of the media

Convert a Word Document into a PDF document

This endpoint accepts the ID (number) of a Word Document and generates a PDF file from it and then stores it into the same media_group of the Document

Body:
{
"media_id": 23
}

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media/file

Convert HTML Script to generate a PDF document

This endpoint accepts HTML code and generate a PDF file from it and then stores it into the specified media_group

post{host_name}/media/document/html_to_pdf_template
Body:
{
"file_name": "PDF_Template1",
"html_content": "<!DOCTYPE html>\n<html>\n<body>\n\n<h1>My First Heading</h1>\n<p>My first paragraph.</p>\n\n</body>\n</html>",
"media_group_id": 113
}

API Request Parameters

NameTypeRequired FieldDescription
file_namestringTrueSimple FileName of this template
html_contentstringTrueHTML code that should used to create a PDF template
media_group_idintegerTrueIdentification of the media_group

Convert an Image into a PDF document

This endpoint accepts the ID (number) of an Image and generates a PDF file from it and then stores it into the same media_group of the Image

Body:
{
"media_id": 23
}

API Request Parameters

NameTypeRequired FieldDescription
media_idintegerTrueThe numeric ID of the of the media/file

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{host_name}/media/versions/thumbnail
Body:
{
"height": 200,
"maintain_aspect_ratio": false,
"media_group_id": 113,
"media_id": 23,
"width": 200
}

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

{host_name}/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