Difference between revisions of "REST Push API"
m (moved REST API to REST File API) |
|||
Line 244: | Line 244: | ||
Retrieve a file | Retrieve a file | ||
+ | |||
+ | = Playback = | ||
+ | |||
+ | == POST app/exec== | ||
+ | |||
+ | Play content once | ||
+ | |||
+ | '''Input (JSON or multi-part form)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | access_token | ||
+ | | Access token returned from ''oauth2/token'' | ||
+ | |- | ||
+ | | uri | ||
+ | | Location of content. May be http://localhost:8080/user-data/... | ||
+ | |- | ||
+ | | packageName | ||
+ | | (Optional) Android package to launch | ||
+ | |- | ||
+ | | className | ||
+ | | (Optional) Android class name | ||
+ | |- | ||
+ | | action | ||
+ | | (Optional) Android action | ||
+ | |- | ||
+ | | type | ||
+ | | (Optional) Android intent type | ||
+ | |- | ||
+ | | extras | ||
+ | | (Optional) Array of Android intent extra parameters | ||
+ | |} | ||
+ | |||
+ | '''Output (JSON)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | uri | ||
+ | | Location of content. May be http://localhost:8080/user-data/... | ||
+ | |- | ||
+ | | packageName | ||
+ | | (Optional) Android package to launch | ||
+ | |- | ||
+ | | className | ||
+ | | (Optional) Android class name | ||
+ | |- | ||
+ | | action | ||
+ | | (Optional) Android action | ||
+ | |- | ||
+ | | type | ||
+ | | (Optional) Android intent type | ||
+ | |} | ||
+ | |||
+ | == POST app/start == | ||
+ | |||
+ | Set default content to play each time player boots up | ||
+ | |||
+ | '''Input (JSON or multi-part form)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | access_token | ||
+ | | Access token returned from ''oauth2/token'' | ||
+ | |- | ||
+ | | uri | ||
+ | | Location of content. May be http://localhost:8080/user-data/... | ||
+ | |- | ||
+ | | packageName | ||
+ | | (Optional) Android package to launch | ||
+ | |- | ||
+ | | className | ||
+ | | (Optional) Android class name | ||
+ | |- | ||
+ | | action | ||
+ | | (Optional) Android action | ||
+ | |- | ||
+ | | type | ||
+ | | (Optional) Android intent type | ||
+ | |- | ||
+ | | extras | ||
+ | | (Optional) Array of Android intent extra parameters | ||
+ | |} | ||
+ | |||
+ | '''Output (JSON)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | uri | ||
+ | | Location of content. May be http://localhost:8080/user-data/... | ||
+ | |- | ||
+ | | packageName | ||
+ | | (Optional) Android package to launch | ||
+ | |- | ||
+ | | className | ||
+ | | (Optional) Android class name | ||
+ | |- | ||
+ | | action | ||
+ | | (Optional) Android action | ||
+ | |- | ||
+ | | type | ||
+ | | (Optional) Android intent type | ||
+ | |} | ||
+ | |||
+ | == POST app/switch == | ||
+ | |||
+ | Switch to play default content | ||
+ | |||
+ | '''Input (JSON or multi-part form)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | access_token | ||
+ | | Access token returned from ''oauth2/token'' | ||
+ | |- | ||
+ | | mode | ||
+ | | Set to "start" to play default content | ||
+ | |- | ||
+ | | ifModifiedSince | ||
+ | | (Optional) Switch to content if it is modified after this ISO8601 date/time | ||
+ | |} | ||
+ | |||
+ | '''Output (JSON)''' | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Parameter | ||
+ | ! Function | ||
+ | |- | ||
+ | | uri | ||
+ | | Location of content. May be http://localhost:8080/user-data/... | ||
+ | |- | ||
+ | | packageName | ||
+ | | (Optional) Android package to launch | ||
+ | |- | ||
+ | | className | ||
+ | | (Optional) Android class name | ||
+ | |- | ||
+ | | action | ||
+ | | (Optional) Android action | ||
+ | |- | ||
+ | | type | ||
+ | | (Optional) Android intent type | ||
+ | |} |
Revision as of 06:55, 17 October 2012
Applies to: IAdea XMP-2200, XMP-2300 media appliances
You may push SMIL scripts and media files into a player using a REST API as documented below.
Contents
Naming
The REST API can be accessed via prefix
http://(device_ip):8080/v2/
appended by API call. For example, for API
POST oauth2/token
the actual HTTP request should be sent to (device_ip) at port 8080, with content similar to:
POST /v2/oauth2/token HTTP/1.1 Host: (device_ip) Content-Type: application/x-www-form-urlencoded;charset=UTF-8 grant_type=password&username=...
Authentication
Before a remote client can access the player, it must authenticate itself by providing the access password set in the player.
POST oauth2/token
Request an access token for API calls.
Input (Multi-part form)
Parameter | Function |
---|---|
grant_type | Must be "password" |
username | User name requesting access. Device default value is "admin" |
password | Password. Device default value is the empty string "" |
Output (JSON)
Parameter | Function |
---|---|
access_token | Authorization token for further API access |
token_type | Always "Bearer" |
expires_in | Number of seconds before the access_token expires |
Media Transfer
POST files/new
Create a file under http://(device_ip):8080/user-data download path
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
downloadPath | Path of file, must start with prefix /user-data/ |
data | (Optional) File encoded in multipart/form-data |
fileSize | (Required except when data is provided) Size of file; if provided file can be uploaded in separate chunks |
etag | (Optional) User-supplied unique string for version identification; default empty string |
mimeType | (Optional) MIME type of the file; default empty string |
modifiedDate | (Optional) ISO8601-encoded date time string indicating modified date time; default empty string |
Output (JSON)
FileResource structure:
Parameter | Function |
---|---|
id | String for identifying the file in subsequent operations |
downloadPath | Path of file to append after http://(device_ip):8080 |
fileSize | Size of file |
etag | Unique string for version identification |
mimeType | MIME type of the file |
modifiedDate | ISO8601-encoded date time string indicating modified date time; default empty string |
transferredSize | Size uploaded into the player |
completed | Boolean (true or false) indicating whether file upload has completed |
GET files/(id)
Get file information
Input (JSON or multi-part form)
None
Output (JSON)
FileResource structure
POST files/(id)
Modify a file
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
seek | (Optional) Offset from beginning of file to replace data. Default 0 |
data | (Optional) File encoded in multipart/form-data |
downloadPath | Path of file, must start with prefix /user-data/ |
etag | (Optional) User-supplied unique string for version identification; default empty string |
mimeType | (Optional) MIME type of the file; default empty string |
modifiedDate | (Optional) ISO8601-encoded date time string indicating modified date time; default empty string |
Output (JSON)
FileResource structure
POST files/find
List files on the system
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
maxResults | (Optional) Max number of file records to return |
pageToken | (Optional) Continuation record |
query | (Optional) Reserved |
Output (JSON)
Parameter | Function |
---|---|
nextPageToken | null of an identifier for report continuation |
items | Array of FileResource structures |
POST files/delete
Delete a file
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
id | ID string of file returned by files/new |
Output (JSON)
None
GET (downloadPath)
Retrieve a file
Playback
POST app/exec
Play content once
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
uri | Location of content. May be http://localhost:8080/user-data/... |
packageName | (Optional) Android package to launch |
className | (Optional) Android class name |
action | (Optional) Android action |
type | (Optional) Android intent type |
extras | (Optional) Array of Android intent extra parameters |
Output (JSON)
Parameter | Function |
---|---|
uri | Location of content. May be http://localhost:8080/user-data/... |
packageName | (Optional) Android package to launch |
className | (Optional) Android class name |
action | (Optional) Android action |
type | (Optional) Android intent type |
POST app/start
Set default content to play each time player boots up
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
uri | Location of content. May be http://localhost:8080/user-data/... |
packageName | (Optional) Android package to launch |
className | (Optional) Android class name |
action | (Optional) Android action |
type | (Optional) Android intent type |
extras | (Optional) Array of Android intent extra parameters |
Output (JSON)
Parameter | Function |
---|---|
uri | Location of content. May be http://localhost:8080/user-data/... |
packageName | (Optional) Android package to launch |
className | (Optional) Android class name |
action | (Optional) Android action |
type | (Optional) Android intent type |
POST app/switch
Switch to play default content
Input (JSON or multi-part form)
Parameter | Function |
---|---|
access_token | Access token returned from oauth2/token |
mode | Set to "start" to play default content |
ifModifiedSince | (Optional) Switch to content if it is modified after this ISO8601 date/time |
Output (JSON)
Parameter | Function |
---|---|
uri | Location of content. May be http://localhost:8080/user-data/... |
packageName | (Optional) Android package to launch |
className | (Optional) Android class name |
action | (Optional) Android action |
type | (Optional) Android intent type |