Skip to main content

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
MethodPOST
URL or Endpoint/api/projects/projectId/encodes/videoId/preview
HeadersAuthorization
ParametersprojectId, videoId
BodyCheck the request body below.

The description of the URL parameters is as follows:

URL Parameter NameMandatoryTypeDescription
projectIdYesstringUnique Id of the project.
videoIdYesstringUnique Id of the video for which the preview is generated.

Request Body

{
"previewSeconds": 0
}

The description of the parameters is as follows:

Body Parameter NameMandatoryTypeDescription
previewSecondsYesintegerDuration of the preview in seconds. Must be greater than zero and cannot exceed the total duration of the video.
info

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.

tip

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 NameTypeDescription
successbooleanIf the response is successful it will return true. Otherwise it will return false.
errorsarray[string]Indicates if there was an error.
messagesarray[string]Returns the response message from the back-end.
resultobjectReturns the response object.
namestringThe public identifier of the video the preview was requested for.
resultInfostringReturns extra information about the result.
statusCodeintegerReturns 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