Getting Started
Get started with the Vatis Streams API for pre-recorded content
Examples
Visit our GitHub samples repository for the complete list of examples on how to use the Vatis Streams API.
Prerequisites
- Vatis API key
- Linux shell
- cURL or Postman for making HTTP or WebSocket requests
- jq for parsing JSON responses
uuidgen
for generating UUIDs- a testing audio/video file
Workflow
Export variables
Choose a stream configuration
The stream configuration defines what processing will be made on the input data (transcoding, transcription, diarization, audio intelligence, etc.). Pick one of the the predefined configurations:
Export the configuration ID:
Upload the data
Use one of the available gateways for uploading the data.
Set the streamConfigurationTemplateId=$CONFIG_ID
, persist=true
, and any other patches as query parameters and upload the binary data as the body of the request.
The configuration-specific patches (parameters) can be found under the Parameters
section of the configuration page.
HTTP Gateway with form-data
approachThe body will be sent as binary data on the request body. The actual body can be one of the options mentioned under the Input data
section of the configuration page.
Content-Type: application/octet-stream
headerSet the streamConfigurationTemplateId=$CONFIG_ID
, persist=true
, and any other patches as query parameters and upload the binary data as the body of the request.
The configuration-specific patches (parameters) can be found under the Parameters
section of the configuration page.
HTTP Gateway with form-data
approachThe body will be sent as binary data on the request body. The actual body can be one of the options mentioned under the Input data
section of the configuration page.
Content-Type: application/octet-stream
headerWe can use dynamic webhooks to specify callback URLs at the request level that will be triggered when the state changes for the stream resource we’re creating. Generally, we’d want to know when the stream enters its COMPLETED
or FAILED
state.
To declare a webhook for this two events we should set the following query parameters:
webhook.stream.completed=http://my_domain/webhook-callback
webhook.stream.failed=http://my_domain/webhook-callback
completed
and failed
webhooks can be the same, and the actual state can be parsed from the received bodyWe should also set the common streamConfigurationTemplateId=$CONFIG_ID
, persist=true
, and any other patches as query parameters and upload the binary data as the body of the request.
In some scenarios, the patches (parameters) values are too long to be included in the URL. In this case, we can use the multipart/form-data
content type to send the patches as form data.
The request body will contain exactly two parts in this specific order:
- The patches as JSON encoded HTTPStreamConfigurationDto
- The binary data to be uploaded on the stream
Here’s an example of a stream configuration
① The configuration-specific patches (parameters) can be found under the Parameters
section of the configuration page
② The webhook URL
③ The events that will trigger the webhook. The complete list can be found here
The complete request will look like this:
Considerations:
- The first part has a limit of
1 MB
- If possible, include the part content type (
application/json
, andapplication/octet-stream
respectively) - The parts name is not relevant
Wait for stream completion
The configured webhook will be triggered with a POST
request having the Webhook event payload containing the Stream state changed event.
From the received payload we should extract the streamId
and the state as shown below:
If the stream state is FAILED
, we should inspect the stream errors and retry the upload.
Refer to the Webhook integration for the complete webhooks documentation.
Export the final result
After the stream is completed, we can export the final result as JSON using the following command:
Based on the stream configuration, the result will be the one mentioned under the Export response
section of the configuration.