API Samples
Scripts that run against our API can be written in any language you feel comfortable with, but for the purpose of this documentation, we have chosen JavaScript with Node.js.
We created a few samples to help you gain context and make it easier to start integrating with our API.
Common Functions
The common.js file contains useful functions to be used in other scripts:
- fetch a file based on its S3 path;
- compose GraphQL requests;
- authorize requests and responses based on your signature.
Assets Sample
The assets.js sample script contains the following operations:
- connect to the API through the use of Common Functions;
- create an asset;
- add media items to the asset;
- return a paginated list of all media items within the asset.
Demux Sample
The demux.js sample script contains the following operations:
- connect to the API through the use of Common Functions;
- create a MediaWarp profile;
- start MediaWarp on a specific media item;
- poll for MediaWarp workflow updates;
- return the MediaWarp result or error messages.
IMF to Flat Sample
The imf2flat.js sample script contains the following operations:
- connect to the API through the use of Common Functions;
- search for a CPL to convert;
- transcode the CPL according based on a predefined transcoder profile;
- poll for workflow updates;
- return the locator for the resulting file or error messages.