0.14.1 • Published 8 years ago
ooyala-api v0.14.1
ooyala-api
Ooyala API client library and CLI for Node.js
Install
API
const OoyalaApi = require('ooyala-api');
const api = new OoyalaApi('Your Ooyala API Key', 'Your Ooyala API Secret', {concurrency: 6});
const embedCode = 'Content ID';
// GET
api.get(`/v2/assets/${embedCode}`)
.then((body) => {
// JSON object
})
.catch((err) => {
// Error response
});
// GET (with params + pagination)
api.get('/v2/assets', {where: `labels+INCLUDES+'Music'`}, {recursive: true})
.then((items) => {
// All items in an array (recursive calls will be done internally)
})
.catch((err) => {
// Error response
});
// POST
api.post('/v2/assets', {}, {
name: `test ${Date()}`,
asset_type: 'remote_asset',
is_live_stream: true,
stream_urls: {
'flash': FLASH_URL,
'iphone': IPHONE_URL
}
}).then((body) => {});
// DELETE
api.delete(`/v2/assets/${embedCode}`).then((body) => {});options
| API | Option Name | Type | Default | Meaning |
|---|---|---|---|---|
| constructor | subdomain | String | "api" | Will be used to construct the destination server's host name. (default=api.ooyala.com) |
| constructor | secure | Boolean | false | If true, the library sends https request |
| constructor | expirationTime | Integer | 86400 | TTL of the API call in seconds |
| constructor | concurrency | Integer | 5 | Limits the number of concurrent API calls. The valid range is 1~10 |
| constructor | accountSecret | String | "" | Account Token API's secret key |
| get | recursive | Boolean | false | If true, the library calls API recursively as long as next_page is specified in the response |
| get, post, put, delete, patch | headers | Object | undefined | If the object contains HTTP headers, the key-value pairs are used for the request. |
| get, post, put, delete, patch | requestURL | String | undefined | If defined, the url is just used. No params are added internally. |
| get, post, put, delete, patch | accountId | String | undefined | If defined, Account Token API will be called with the specified accountId before the main API call. And then its return value (account_token) will be used for the main API call. |
| get, post, put, delete, patch | subdomain | String | (the value specified at constructor) | Overrides the value specified at constructor. |
| get, post, put, delete, patch | secure | Boolean | (the value specified at constructor) | Overrides the value specified at constructor. |
CLI
Please put config file(s) in your work directory.
$ mkdir config
$ vi config/default.json
{
"api": {
"key": "Your Ooyala API Key",
"secret": "Your Ooyala API Secret"
}
}Usage:
oo [options] command [parameters]
Options:
-h, --help Print help
-v, --version Print version
Commands:
token Generates Ooyala player token (OPT) request URL.
sign Generates a signature based on given params.
upload Uploads file(s).
remote Creates a remote asset
source Downloads source file to stdout
Syntax:
oo token embed-code(s) [accountId]
oo sign url [method body]
oo upload local-file-path(s) [title chunkSize profile]
oo remote asset-name [dash hls hds]
oo source embed-code [info]
Example:
oo -v
oo token embed_code
oo token embed_code1 embed_code2
oo token embed_code --expiration 604800
oo token embed_code --accountId david1203
oo sign /hoge?foo=bar
oo sign /hoge?foo=bar --body '{"data": {"comment": "This is JSON"}}'
oo sign /hoge?foo=bar --body '{"data": {"comment": "This is JSON"}}' --method PATCH
oo upload ./path/to/file --title "My video"
oo upload ./path/to/files/*.mp4 --title "My videos" --chunkSize 1024 --profile abc
oo upload ./path/to/files --title "My VR 360 videos" --profile xyz --vrType monoscopic
oo remote "My remote asset" --dash http://x.jp/a.mpd --hls http://x.jp/a.m3u8 --hds http://x.jp/a.f4m
oo source embed_code1 --info
oo source embed_code1 > ./path/to/file
oo source embed_code1 --resume ./path/to/file
Parameters:
expiration TTL of the signature in seconds (this param works with every command that requires signing)
accountId Viewer's login id (default = undefined)
method (GET | POST | PUT | DELETE | PATCH) default = GET
body Body string (default = '')
title Title of the video (default = {file name} if multiple files are specified, the title is suffixed by '- part n')
chunkSize Byte size of each chunk (default = 204800)
profile Profile id used for encoding
vrType monoscopic or stereoscopic(side-by-side)
dash Remote asset URL for MPEG-DASH
hls Remote asset URL for HTTP Live Streaming
hds Remote asset URL for HTTP Dynamic Streaming
info If specified the output will be source_file_info
resume An existing file to which the data will be appended0.14.1
8 years ago
0.14.0
8 years ago
0.13.3
8 years ago
0.13.2
8 years ago
0.13.1
8 years ago
0.13.0
8 years ago
0.12.1
9 years ago
0.12.0
9 years ago
0.11.1
9 years ago
0.11.0
9 years ago
0.10.0
9 years ago
0.9.1
9 years ago
0.9.0
9 years ago
0.8.0
9 years ago
0.7.1
9 years ago
0.7.0
9 years ago
0.6.5
9 years ago
0.6.4
9 years ago
0.6.3
9 years ago
0.6.2
9 years ago
0.6.1
9 years ago
0.6.0
9 years ago
0.5.2
9 years ago
0.5.1
9 years ago
0.5.0
9 years ago
0.4.5
9 years ago
0.4.4
9 years ago
0.4.3
9 years ago
0.4.2
9 years ago
0.4.1
9 years ago
0.4.0
9 years ago
0.3.1
9 years ago
0.2.4
9 years ago
0.2.3
9 years ago
0.2.2
9 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago



