Show video upload status
If you don't want to use webhooks to receive a notification about the status of a video you uploaded, you can use a polling method with this endpoint instead. When you send a request, you receive a response that tells you the status of your video upload.
Associated API reference documentation
Choose an api.video client
The clients offered by api.video include:
Installation
To install your selected client, do the following:
go get github.com/apivideo/api.video-go-client
composer require api-video/php-api-client
npm install @api.video/nodejs-client --save
...or with yarn:
yarn add @api.video/nodejs-client
pip install api.video
Using Nuget
Install-Package ApiVideo
Retrieve your API key
You'll need your API key to get started. You can sign up for one here: Get your api.video API key!. Then do the following:
- Log in to the api.video dashboard.
- From the list of choices on the left, make sure you are on API Keys
- You will always be able to choose to use your Sandbox API key. If you want to use the Production API key instead, enter your credit card information.
- Grab the key you want, and you're ready to get started!
Retrieve video upload status
To retrieve the status of a video you uploaded, use this code sample:
curl --request GET \
--url https://ws.api.video/videos/{video ID here}/status \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2NDI3NDM2MjEuMDAxMTYzLCJuYmYiOjE2NDI3NDM2MjEuMDAxMTYzLCJleHAiOjE2NDI3NDcyMjEuMDAxMTYzLCJwcm9qZWN0SWQiOiJwclJ6SUpKQTdCTHNxSGpTNDVLVnBCMSJ9.c1rrzpPWno4spJvrlFdgvV7yqRk72lfjd9eXLlvbrCM06WCsJmC0ZJQsA8PcrjDvwNpgQiIwbYaIv7wg8_YvM1aUN4EmEF9JgInzVGQcu4Bluu5pb8P00nWaez4aR9AYkeaIwrsHdsR3kA_68Y7gy5uWzMElLREIT1z7TENW-8aOYv5rhxX502kDSbm8qZyL_2gaNi4WfyuF81Sq2siBlB2t2aGOwc7IB86kuyfWqmtzbwUvOgPcmaCKW9vapZO0WViJoT7pnKx5kIdggZNMH9wOELC_A5AujJBjvlNEmHAJ8xREUrgHTo87Oz920cNFOdj16Wx4OokbyNFJVL3mIA'
package main
import (
"context"
"fmt"
"os"
apivideosdk "github.com/apivideo/api.video-go-client"
)
func main() {
client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
// if you rather like to use the sandbox environment:
// client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
videoId := "vi4k0jvEUuaTdRAEjQ4Jfrgz" // string | The unique identifier for the video you want the status for.
res, err := client.Videos.GetStatus(videoId)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `Videos.GetStatus``: %v\n", err)
}
// response from `GetStatus`: VideoStatus
fmt.Fprintf(os.Stdout, "Response from `Videos.GetStatus`: %v\n", res)
}
use Symfony\Component\HttpClient\Psr18Client;
use ApiVideo\Client\Client;
use ApiVideo\Client\Model\VideosApi;
use ApiVideo\Client\Model\UploadTokensApi;
$apiKey = 'your API key here';
$apiVideoEndpoint = 'https://ws.api.video';
$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$client = new ApiVideo\Client\Client(
$apiVideoEndpoint,
$apiKey,
$httpClient
);
$videos = $client->videos()->getStatus('video ID here');
print($videos);
const ApiVideoClient = require('@api.video/nodejs-client');
(async () => {
try {
const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" });
const videoId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier for the video you want the status for.
// VideoStatus
const result = await client.videos.getStatus(videoId);
console.log(result);
} catch (e) {
console.error(e);
}
})();
# Check the status of a video by video ID
import apivideo
from apivideo.apis import VideosApi
from apivideo.exceptions import ApiAuthException
api_key = "your api key here"
video_id = "video ID to get the status of here"
client = apivideo.AuthenticatedApiClient(api_key)
# If you'd rather use the sandbox environment:
# client = apivideo.AuthenticatedApiClient(api_key, production=False)
client.connect()
videos_api = VideosApi(client)
# Get the status of your video
response = videos_api.get_status(video_id)
print(response)
Conclusion
If you want to use polling to find out whether a video completed upload, this method works great. If you want events to be sent notifying you when a status completes, try the webhooks content instead.
Updated 12 months ago
If you don't want to poll for this information, you can also use webhooks to receive events.