Make API Requests

Last update:2024-01-15 15:06:28

This section provides information on how to structure and initiate a media processing API call. Before proceeding, please ensure that the media processing service is enabled and that the correct pair of AccessKey and AccessKey Secret for the active account is available.

Request Structure

Request Method

Currently, only POST method is supported for the media processing requests.

Request URI

The request URI should be structured as follows:

http://<API Address>/<Resource-path>
Parameter Description
Communication Protocol Currently, requests can only be sent using HTTP.
API Address Also known as the Manage Domain on Object Storage, this can be found at Object Storage > Bucket > Overview > Manage Domain on console.
Resource-path Unless otherwise specified, the resource path should remain as fops.

Example URI

Request Header

Every request must include authentication information to validate the requester’s identity. This should be included in the request header Authorization which comprises AccessKey and EncodeSign:

//Authorization is the request header name

Authorization:<AccessKey>:<EncodeSign>

For details on generating the token, please refer to the Authentication.

Request Body

The API requires a request body, specifying the bucket and file to be processed and the type of processing needed.
Structure the request body as follows:

bucket=[Bucket]&key=[Key]&fops=[Fops]&notifyURL=[NotifyURL]&force=[Force]&separate=[Separate]
Parameter Required Description
bucket Yes Name of the bucket containing target file for processing in Object Storage.
key Yes The name of the file to be processed.
fops Yes The fops parameter indicates the type of media processing you wish to perform on your videos or audios. You should tailor your fops according to the specific processing required. For detailed instructions on structuring fops for different tasks, please refer to the following sections: Transcoding, Transmuxing, Video Encryption, Intelligent Transcoding and Editing.
notifyURL No Also known as the callback address. When a media processing task fails or completes, a notification is sent to this address. The notifyURL should be URL safe base64 encoded when included in the request body.
For more details about callbacks, refer to Callback Notification.
force No Specifies whether to overwrite existing files. This is useful to avoid unnecessary processing if the file has already been processed.
0 - Not to overwrite if the target file already exists.
1 - Still process the file and overwrite even if the target file exists.
The default value is 0.
separate No Notification method:
0 - Sends a notification to your callback server only after all processing tasks are complete.
1 - Sends notifications to your callback server separately.
The default value is 0.

Request Example

curl -v -X POST --url "http://mgrDomain/fops"
-d "bucket=aW1hZ2Vz&key=bGVodS5tcDQ==&fops=YXZ0aHVtYi9mbHYvcy80ODB4Mzg0fHNhdmVhcy9hVzFoWjJWek9tZHFhQzVtYkhZPQ=="
-H "Authorization:86622e227a50d49d858c2494a935bc2e4ac543a7:Y2JmMGY0YTNhZmQxZmVlZGM2ZTA0YTdjNTcyOWQ1NjRkNTExYjg0Yg==" 
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!