Getting Started
INTRODUCTION
This document is intended for system integrators and users of Fastedge. Our API will give you access to maintained encoding engines for all your media files. Each API is defined in enough detail to explain how to use the system and how it can be integrated into larger workflow automation systems.
PROTOCOLS
All requests take the form of standard HTTP POST request.
All requests must include the HTTP "Accept" header to specify the media type of the server's response. Responses can be JSON (Accept: application/json). Additional headers are required when authentication is enabled on the server
POST https://www.fastedge.ai/cloud-video-transcoding/app/service
Accept: application/json
Content-Type: application/json
ApiKey: aefoi66drgg3wkoisecv567dcvb4
PREREQUISITE
All requests must include the HTTP "Accept" header to specify the media type of the server's response. Responses can be JSON (Accept: application/json). Additional headers are required when authentication is enabled on the server
API KEY
To use the Fastedge API, you must first create an account. This API Keys allow complete access to the API.
It is customer unique authentication key string. It is created automatically when a customer is registered and can be regenerated at anytime in the My Information Section.
ACCOUNT NUMBER
It is unique customer identifier. This account number can be found in the My Information section of the Client Interface.
CMD
It is an action that can be submitted in an API request. Example createJob, getJobs, deleteJob and etc.
END POINT URI
It is recommended to use an API version prefix with endpoint URI. The API version prefix allows you to specify which API version the server should use to interpret your data.
Please send all HTTP(s) post requests to:
https://api/v1.1.0/fastedge.in
EXAMPLE REQUEST RESPONSE FORMAT
REQUEST
{
"cmd": "getJobs",
"accountNumber": "1001"
....
}
{
"code": 200,
"message": "OK",
"messageDescription:": "Template has been created",
"requestId": "5644885",
"timestamp": 948234938400
....
}
TRY IT
Our Try it option to verify and test your JSON without writing a single line of code.
WEBHOOK
A tool to notify your system when a video encoding job successfully finishes processing or transferred output file to the desired destination and is ready to publish or stream.
When you run jobs, you often require a way to track job progress. You can monitor Media Services job notifications by using Fastedge Webhooks.Fastedge sends Webhook events to notify your system of changes in state.Please ensure that your webhook handling mechanism treats duplicated event delivery appropriately.This section describes how to work with webhooks.
CONFIGURING ENDPOINTS
After a webhook endpoint URL is configured,notifications will be sent for all events to your system.The webhook endpoints are configured in the client interface under "Account".
Note: Only one webhook endpoint URL is allowed per-account.
RECEIVING A WEBHOOK
Configuring your server URL to receive a webhook is no different from creating any page on your website. Remember that your server is the server receiving the request. Fastedge webhook data is sent as JSON in the request's body.
Your Webhook URL should return a response with HTTP status code 200. Any other HTTP response code will be treated as a failure. It is not necessary for your Webhook response to return any content.
If your Webhook takes 20 seconds or longer to return a response, Fastedge will also treat it as a failure.Veloscoder will retry failed webhooks periodically for up to a day, until receiving a response with HTTP code 200.
{
"id": 49342345,
"eventType": "job.completed",
"timestamp": 948234938400,
"message":"Job [id] is successfully completed",
data:{
}
"errors": {
"errorCode": {
"errorMessage": "unknown_error"
}
}
}
TYPES OF WEBHOOK EVENTS
Event type |
Description |
encoding.completed |
When the job has completed the encoding. |
encoding.failed |
When the job is failed, it will provide the error details. |
transfer.completed |
When the encoded media output file is transferred to the desired destination. |
transfer.failed |
When an error has occurred while transferred output file to the desired destination. |
Encoding Completed
The event call occurs when the job has completed the encoding.
id
int
It is a unique integer indentifier for the webhook .
timestamp
string
Date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
jobId
int
It is unique identifier of encoding job.
mediaId
int
It is unique identifier of input file
output
Array
Array of output file details
{
"id": 6546996,
"eventType": "encoding.completed",
"timestamp": 948234938400,
"message":"Job [id] is successfully completed",
"jobId": "1043",
"mediaId": "46",
"status": "completed",
"output": [
{
"fileName": "1043_6_1800_video.mp4",
"videoLengh": "0",
"fileSize": "",
"url": "http://3.7.115.199/mediafiles/out/1007/1043/1043_6_1800_video.mp4",
},
{
"fileName": "1043_7_1200_video.mp4",
"videoLengh": "0",
"fileSize": "",
"url": "http://3.7.115.199/mediafiles/out/1007/1043/1043_7_1200_video.mp4",
}
],
"errors": {
}
}
Encoding Failed
The event call occurs when the job has failed the encoding.
id
int
It is a unique integer indentifier for the webhook .
timestamp
string
Date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
jobId
int
It is unique identifier of encoding job.
mediaId
int
It is unique identifier of input file
output
Array
Array of output file details
{
"id": 6546996,
"eventType": "encoding.failed",
"timestamp": 948234938400,
"message":"The Job [id] encoding is failed.",
"jobId": "1043",
"mediaId": "46",
"status": "Failed",
"errors": {
errorCode:"File_read_issue",
errorMessage:"source file is not able to read"
}
}
Transfer Completed
The event call occurs when the job has completed the encoding and the output file is transferred to the user-defined storage option.
id
int
It is a unique integer indentifier for the webhook .
timestamp
string
Date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
jobId
int
It is unique identifier of encoding job.
mediaId
int
It is unique identifier of input file
output
Array
Array of output file details
{
"id": 6546996,
"eventType": "transfer.completed",
"timestamp": 948234938400,
"message":"The job [id] output media file is transferred successfully completed",
"jobId": "1043",
"mediaId": "46",
"status": "completed",
"outputInformation": [
{
"fileName": "1043_6_1800_video.mp4",
"videoLengh": "0",
"fileSize": "",
"url": "http://3.7.115.199/mediafiles/out/1007/1043/1043_6_1800_video.mp4",
"totalBitrate": "5600",
"videoBitrate": "5300",
"audioBitrate": "300",
"fileSize": "2460",
"duration": "3600",
"resolution": "1920x1080",
"bitsPerPixel": "0.087",
"aspectRatio": "16:9",
"fps": "30",
"interlace": "TFF",
"bitrateMode": "VBR",
"videoCodec": "MPEG2",
"fileFormat": "ts"
},
{
"fileName": "1043_7_1200_video.mp4",
"videoLengh": "0",
"fileSize": "",
"url": "http://3.7.115.199/mediafiles/out/1007/1043/1043_7_1200_video.mp4",
"totalBitrate": "5600",
"videoBitrate": "5300",
"audioBitrate": "300",
"fileSize": "2460",
"duration": "3600",
"resolution": "1920x1080",
"bitsPerPixel": "0.087",
"aspectRatio": "16:9",
"fps": "30",
"interlace": "TFF",
"bitrateMode": "VBR",
"videoCodec": "MPEG2",
"fileFormat": "ts"
}
],
"errors": {
}
}
Transfer Failed
The event call occurs when the job has completed the encoding and the output file is not able to transfer the user-defined storage option.
id
int
It is a unique integer indentifier for the webhook .
timestamp
string
Date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
jobId
int
It is unique identifier of encoding job.
mediaId
int
It is unique identifier of input file
output
Array
Array of output file details
{
"id": 6546996,
"eventType": "transfer.failed",
"timestamp": 948234938400,
"message":"The Job [id] file transfer is failed.",
"jobId": "1043",
"mediaId": "46",
"status": "completed",
"errors": {
errorCode:"S3_not_connected",
errorMessage:"The user defined storage option is not connected"
}
}