Overview
Currently, you can do the following operations via API:
- Storage management,
- Create a task, search and retrieve information about a task,
- Retrieve credit and profile information.
Authorization
When you log in, you will see a field where you can create a token. After clicking the "Create" button, the token you see should be sent in every request header. The header you must send:
Key: Authorization
Value: Bearer <your_token>
Tasks Service
Let's analyze the following task service example step by step.
{
"input": {
//...
//...
},
"outputs": [
{
//...
//...
},
{
//...
//...
},
]
}
Each task consists of 1 input and "n" outputs. You can add as many outputs as you want. VimQu downloads the input file, performs the operations you want in the output and uploads it back to where you want. Storage is required for downloading and uploading the file. The storage you want to use must be registered in VimQu.
Input
{
"input": {
"source_type": "url",
"path": "https://<your_video_url>.mp4"
},
"outputs": [
{
//...
},
{
//...
}
]
}
Input source_type can be url
or storage
. If source_type is storage, you should also send the storage_id
field. In both cases we will verify the input file. There is a 12 second connection timeout limit. If we can't access the file within 12 seconds, you will get a 422 response code.
Storages
After logging in to your VimQu account, you should go to the "Storages" page from the menu. After adding the storage service (gcs, any S3, ftp/sftp, azure) information you use, you can use the ID information in your requests.
{
"input": {
"source_type": "storage",
"storage_id": "<your_ftp_storage_id>",
"path": "/itx_case_4k.webm"
},
"outputs": [
{
"storage_id": "<your_s3_storage_id>",
"target_path" : "/outputs/hls",
//...
},
{
"storage_id": "<your_azure_storage_id>",
"target_path" : "/outputs/mpeg_dash",
//...
}
]
}
In the example above;
VimQu will download itx_case_4k.webm
file from your registered ftp address.
It will do the operations you requested for the first output and upload it to your S3 account. The file will be uploaded to /outputs/hls
directory.
For the second output, it will do the operations you want and upload it to your Azure account. The file will be uploaded to /outputs/mpeg_dash
directory.
All storage information is encrypted and stored in systems such as vault
Output Types
{
"input": {
"source_type": "storage",
"storage_id": "<your_ftp_storage_id>",
"path": "/itx_case_4k.webm"
},
"outputs": [
{
"storage_id": "<your_s3_storage_id>",
"target_path" : "/outputs/thumbnail",
"type": "thumbnail",
"type_specific_config" : {
//...
}
//...
},
{
"storage_id": "<your_azure_storage_id>",
"target_path" : "/outputs/hls",
"type": "hls",
"type_specific_config" : {
//...
}
//...
}
]
}
There must be a type for each output. These types can be thumbnail, video, hls, mpeg_dash. You should send type_specific_config
for each type. For example, for thumbnails, you will send image size information or for hls you will send variant information like 720p, 1080p in type_specific_config
.
Reference
Task
Input
Field | Required | Default | Available Values | Description |
---|---|---|---|---|
source_type | YES | - | url, storage | where to download the input file |
storage_id | if storage_type is storage then YES, if storage_type is url NO | null | null or your storage_id | Your previously saved storage id |
path | YES | - | valid URL or path to your file (absolute path) | You should send valid URL if storage_type is url. If storage_type is storage you can send absolute path to file. Example: /inputs/hls |
Output
Field | Required | Default | Available Values | Description |
---|---|---|---|---|
storage_id | YES | - | uuid | Your previously saved storage id |
reference_id | NO | null | string or null | This field for your usage. You can send any value. This value will be sent to you in notifications |
target_path | YES | - | string | Absolute path to your output directory |
type | YES | - | thumbnail, video, hls, dash | Example: /outputs |
type_specific_config | YES | - | type_specific_config object | There is type_specific_config for each type. In Task Service there is an example for each usage |
Common Task Result Object
Every time when you create a task, when you query a single task result, when the task result is sent to you via webhook, you will see the following payload.
{
"data": {
"id": "0aead065-7a32-4907-b908-698d32ec1388",
"created_at": "2022-01-06 10:55:31",
"status": "completed",
"outputs": [
{
"id": "ac8543e4-7535-4552-b803-ff3c5249757a",
"reference_id": "<your_reference_id>",
"storage": {
"id": "edf6f4ef-145a-4c46-bfb9-17aaf76c2160",
"name": "<your_storage_name>",
"driver": "ftp"
},
"target_path": "/outputs/number",
"type": "thumbnail",
"files": [
{
"path": "/outputs/thumbnails/thumb_00001.png",
"uploaded_at": "2022-01-06 01:08:23"
},
{
"path": "/outputs/thumbnails/thumb_00002.png",
"uploaded_at": "2022-01-06 01:08:23"
}
]
}
]
}
}
Field | Type | Possible Values | Description |
---|---|---|---|
id | uuid | - | ID of Task |
created_at | datetime | - | Created time of task. UTC |
status | string | active, processing, completed, canceled, failed | It shows the current status of the task |
outputs | array | - | Requested outputs |
outputs.id | uuid | - | ID of output |
outputs.reference_id | string | any | Your reference_id. You sent it in request body |
outputs.storage | array | - | Storage where the output file is uploaded |
outputs.target_path | array | - | Path to the directory where the output file was uploaded |
outputs.type | string | thumbnail, hls, dash, video | Type of output |
outputs.files | array | - | Path to the file where the output file was uploaded |
Response Codes
The VimQu API can give the following response codes.
Http Status Code | Description |
---|---|
200 | OK |
201 | OK, Created |
400 | Bad Request, request body invalid, unable to process |
401 | Unauthenticated, Bearer token is invalid. |
402 | Payment Required |
403 | Unauthorized, your account has been suspended for some reason or your transaction is not allowed. For detailed information, see the message value in the response body |
404 | Endpoint / object not found |
422 | There are incorrect values in the request body. Incorrect values sent in response message |
429 | Too Many Request (Currently 60 requests per minute. If you need a higher limit please contact us ) |
500 | Internal Server Error. If this happens, we will check immediately. We monitor unwanted situations |
If you have any questions, please share them with us.