REST-API References

This REST-API reference focuses on garlic-player, but it is compatible with the Android-based media player from IAdea. Some results may vary.

Authentication

Every API call requires a token to be passed as a GET parameter. This section of the authentication explains how to obtain the token.

Input parameter description for /v2/oauth2/token
ParameterFunction
grant_typeMust be the string “password”, currently
usernameUsername requesting access, admin by default
passwordPassword is currently not supported
Output parameter description for /v2/oauth2/token
ParameterFunction
access_tokenThis is the authorization token you need to use for every other API call. You must send it as a GET parameter.
expires_inAn ISO date of the time, when the token expires.
token_typeBearer is default

You will find an example how to use the authentication in the Introduction Tutorial.

Handling of Media Files

For working with media files, we have the typical CRUD (creation, read, update, and delete) functions. In our cases, the “C” for create is equal to upload.

Create: Upload a Media via files/new

JSON and multipart form are supported

Input parameter description for /v2/files/new
ParameterFunction
downloadPathPath of media file. In IAdea player, it must start with prefix /user-data/. Garlic-player put the files in the cache directory.
dataFile encoded in multipart/form-data
fileSizeSize of file
Out parameter in JSON
ParameterFunction
completedBoolean (true or false) describes if the file upload is complete. If it is not completed, look at the transferredSize parameter.
idThe unique identification for the file
downloadPathPath of file. In garlic-player, this is the cache directory.
fileSizeSize of file
modifiedDateISO8601-encoded date time string indicating modified date time; default is an empty string.
transferredSizeSize uploaded

Read: Find Files

The 'find' API command lists the media files paginated as JSON.

Input (JSON or multipart form) for files/find
ParameterFunction
maxResults(Optional) Max number of file records to return
pageToken(Optional) Continuation record

If you do not enter an input parameter, all files in the cache directory will be shown.

Output as JSON
ParameterFunction
nextPageTokennull of an identifier for report continuation
itemsArray of a so-called FileResource structure described in ID

Get ID to read

This is a GET request. It requires the ID as directory and the token in this URI form: http://your_device_ip:8080/v2/files/ID?access_token=YOUR_ACCESS_TOKEN

Output of the as JSON as FileResource structure
ParameterFunction
idString for identifying the file in subsequent operations
downloadPathPath of file. This is normally the cache directory of the player.
fileSizeSize of file in byte
etagUnique string for version identification. This is identically with the ID.
mimeTypeMIME type of the file
modifiedDateISO8601-encoded date time string indicating modified date time; default empty string
transferredSizeSize uploaded into the player
completedBoolean (true or false) indicating whether file upload has completed.

Update: Edit a media file record

These are the same parameters as in upload media.

Input parameter description for /v2/files/ID
ParameterFunction
downloadPathPath of media file. In IAdea player, it must start with prefix /user-data/. Garlic-player put the files in the cache directory.
dataFile encoded in multipart/form-data
fileSizeSize of file

The output is the FileResource structure.

Delete Media File

To delete a media, you need the parameter in body as JSON or multipart form.

Input parameter for /v2/files/delete
ParameterFunction
idString for identifying the file in subsequent operations

The response is an HTTP 200 OK if succeeded.

Playback functions

The playback function handles the set and switch to a specific SMIL-Index as Content-URL. Furthermore, you can trigger an instant display of a media via REST-API.

Set Default Content-URL

Setting a new SMIL-index as Content-URL. The current displayed index will not be interrupted. On a reboot or restart, the new set Content-URL will be used.

Input parameter description for /v2/app/start
ParameterFunction
uriLocation of content. URI can be: https://domain.tld/index.smil
packageNameOptional and currently not used with garlic-player. For IAdea: On Android, it can be package to launch.
classNameOptional and currently not used with garlic-player. For IAdea: On Android, it can be a class-name to launch.
actionOptional and currently not used with garlic-player. For IAdea: On Android, it can be an action.
typeOptional and currently not used with garlic-player. For IAdea: On Android, it can be a type.
extrasOptional and currently not used with garlic-player. For IAdea: On Android, it can be extra parameters for intents.
Out parameter as JSON
ParameterFunction
uriLocation of content. URI can be: https://domain.tld/index.smil
packageNameOptional and currently not used with garlic-player. For IAdea: On Android, it can be package to launch.
classNameOptional and currently not used with garlic-player. For IAdea: On Android, it can be a class-name to launch.
actionOptional and currently not used with garlic-player. For IAdea: On Android, it can be an action.
typeOptional and currently not used with garlic-player. For IAdea: On Android, it can be a type.

Execute a SMIL-Index once

Setting a new SMIL-index as Content-URL and play it once. Then jump back to the default Content-URL.

The input and output parameter for /v2/app/exec are the same as /v2/app/start.

Switch to set Content-URL

This command causes the player switching to the default Content-URL.

Input parameter description for /v2/app/switch
ParameterFunction
modeCurrently, the only supported value is “start”

The output parameter for /v2/app/switch are the same as /v2/app/start

Network Trigger via notify

This is a trigger event for jumping to a previous set network trigger via notify in begin or end attribute.

Input parameter description for /v2/task/notify
ParameterFunction
smilEventThe name of the trigger point set in notify(). In our tutorial, it is play0001 or play0001.

The response is an HTTP 200 OK if succeeded.

System Management

Reboot

This reboots the operating system immediately. For garlic-player, this works already only on Android. OS related functions require a small helper app. In this case, the garlic-launcher. For Linux, garlic-daemon with similar functions is currently under development.

For /v2/task/reboot, no special input parameter is required. The play reboots instantly, so expect no response.

Screenshot

A secure digital signage player should avoid complex managing apps like team viewer. But in some cases it is necessary to see what is displayed on screen. This is possible with the screenshot API call.

For /v2/task/screenshot, no special input parameter is required. The response is a JPEG image like described in the REST-API introduction.

System Information

This REST-API calls are based on GET and give you some detailed information.

Get Information about the Model

The call is GET so: http://your_device_ip:8080/v2/system/modelInfo?access_token=YOUR_ACCESS_TOKEN

Out parameter as JSON can be empty
ParameterFunction
PCBName of the Printed Circuit Board or player app
PCBRevisionRevision of the Printed Circuit Board
licenseModelSpecified license or name of the operating system
manufacturerManufacturer name or software author
manufacturerURLThe URL to the manufacturer or the player software
modelDescriptionAdditional descriptions of the board model
modelNameAdditional descriptions of the board model
modelDescriptionAdditional descriptions of the board model
modelNameName of the device model
modelURLURL of the device manufacturer
optionsAdditional options of the model, e.g. sensors

Get Information about the Firmware

The call is GET so: http://your_device_ip:8080/v2/system/firmwareInfo?access_token=YOUR_ACCESS_TOKEN

Out parameter as JSON
ParameterFunction
familyProduct model family, like “garlic-player-android”
firmwareVersionFirmware version of the device and player software version