POST Generate Video Preview
Overview
The following table contains important information about the POST method used to generate a short, self-contained preview for a video that has already been encoded. The preview is built from the first previewSeconds seconds of the video and is stored under the video's preview folder.
| POST Generate Video Preview | |
|---|---|
| Method | POST |
| URL or Endpoint | /api/projects/projectId/encodes/videoId/preview |
| Headers | Authorization |
| Parameters | projectId, videoId |
| Body | Check the request body below. |
The description of the URL parameters is as follows:
| URL Parameter Name | Mandatory | Type | Description |
|---|---|---|---|
projectId | Yes | string | Unique Id of the project. |
videoId | Yes | string | Unique Id of the video for which the preview is generated. |
Request Body
{
"previewSeconds": 0
}
The description of the parameters is as follows:
| Body Parameter Name | Mandatory | Type | Description |
|---|---|---|---|
| previewSeconds | Yes | integer | Duration of the preview in seconds. Must be greater than zero and cannot exceed the total duration of the video. |
A preview can only be generated for a video that is fully encoded (its encoding status is Complete or PartiallyCompleted). If a preview has already been generated for the video, or one is currently being processed, the request is rejected.
Use the List Preview Statuses endpoint to retrieve the possible processing states of a preview, and the Video Assets endpoint to read the resulting previewPlayBackUrl once the preview is ready.
Response
{
"success": true,
"errors": [],
"messages": [
"The preview request was accepted and is being processed."
],
"result": {
"name": "{name}"
},
"resultInfo": null,
"statusCode": 202
}
Information about the fields that appear when you receive the response are displayed in the table below.
Top-Level Properties
| Field Name | Type | Description |
|---|---|---|
| success | boolean | If the response is successful it will return true. Otherwise it will return false. |
| errors | array[string] | Indicates if there was an error. |
| messages | array[string] | Returns the response message from the back-end. |
| result | object | Returns the response object. |
| name | string | The public identifier of the video the preview was requested for. |
| resultInfo | string | Returns extra information about the result. |
| statusCode | integer | Returns the HTTP Status Code. |
If the action is successful, the service sends back an HTTP 202 response.
Errors
For information about the errors that are common to all actions, see Common Errors:
HTTP Status Code 400: Bad Request
HTTP Status Code 401: Unauthorized
HTTP Status Code 403: Forbidden
HTTP Status Code 404: Result Not Found
HTTP Status Code 500: Internal Server Error
HTTP Status Code 503: Backend Fetch Failed