9100: Create media
Add a media file to the dialogportal™ Media Archive.
The Media Archive provides a public repository for media files. Currently the allowed file type are:
File type | contentType |
|---|---|
Image |
|
Video |
|
| |
Javascript |
|
Stylesheet |
|
Font |
|
Icon |
|
HTC |
|
Media in the archive is contained in a folder structure, and file and folder names are unique within their respective folders.
When attempting to create a media file with a name that already exists in the folder, the autoName field is used to determine the correct action. When autoName is omitted or set to false, a 303 response will be returned including a location header containing the URL to the existing media file. When autoName is true, the file will be created with an auto-incremented "index" appended to the file name, "file_1.txt", "file_2.txt" etc.
To add new folders simply include them in your folderPath. Folders that do not already exist will be created.
Endpoint ID: | 9100 | |||||||||||||||||||||||||
Method: | ||||||||||||||||||||||||||
URL: | /content/media | |||||||||||||||||||||||||
Request body: | JSON data with information about the media to be created.
Example: Create a single pixel image {
"content": "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
"contentType": "image/gif",
"fileName": "clear 1x1.gif",
"folderPath": "Assets/Generic Images/Small",
"autoName" : true
} | |||||||||||||||||||||||||
Response body: |
Example{
"url": "https://media.dialogportal.com/customer_name/assets/generic_images/small/clear_1x1.gif"
}The URL format is:
The | |||||||||||||||||||||||||
Status codes: | 201 | Media created successfully. | ||||||||||||||||||||||||
| 303 | A media file with this name already exists in the folder. The response includes a | ||||||||||||||||||||||||
| 400.1 | Content type not recognized | ||||||||||||||||||||||||
| 400.2 | Media files may not be larger than 2MB | ||||||||||||||||||||||||