Skip to content

API Documentation

Felix Franz edited this page Nov 13, 2017 · 14 revisions

On this wiki page all api commands are described.

The commands are used to connect to the api running on the local system, change the 127.0.0.1 to you api IP, if it is on a remote system.

Table of Contents

  1. Dispatcher Service
  2. Controller Service
    1. play
    2. pause
    3. stop
    4. reset
    5. backward
    6. shuffle
    7. fullscreen
    8. repeat
    9. forward
    10. state
    11. volume
  3. Instances Service
    1. reconnect
    2. Single Instance Service
      1. instance play
      2. instance pause
      3. instance stop
      4. instance reset
      5. instance backward
      6. instance shuffle
      7. instance fullscreen
      8. instance repeat
      9. instance forward
      10. instance state
      11. instance volume
  4. Server Service
    1. Host


Dispatcher

This is the star point of the api. You only get header links to other api endpoints here.

Command: GET http://127.0.0.1:8080/api



Controller Service

Lists header links to all controller commands.

Command: GET http://127.0.0.1:8080/api/control


play

Starts playing on all player instances.

Command: POST http://127.0.0.1:8080/api/control/play


pause

Pauses all player instances.

Command: POST http://127.0.0.1:8080/api/control/pause


stop

Stops playing on all player instances.

Command: POST http://127.0.0.1:8080/api/control/stop


reset

Restarts current title on all player instances.

Command: POST http://127.0.0.1:8080/api/control/reset


backward

Plays previous title on all player instances.

Command: POST http://127.0.0.1:8080/api/control/backward


shuffle

Toggles shuffle on all player instances.

Command: POST http://127.0.0.1:8080/api/control/shuffle


fullscreen

Toggles full screen on all player instances.

Command: POST http://127.0.0.1:8080/api/control/fullscreen


repeat

Toggles repeat on all player instances

Command: POST http://127.0.0.1:8080/api/control/repeat


forward

Plays next tile on all player instances

Command: POST http://127.0.0.1:8080/api/control/forward


state

Outputs the current state of the master.

Command: GET http://127.0.0.1:8080/api/control/state


volume

Shows the volume of the master.

Command: POST GET://127.0.0.1:8080/api/control/volume

Sets the volume of the master.

Command: POST http://127.0.0.1:8080/api/control/volume



Instances Service

Outputs all infos about all player instances as JSON.

Command: GET http://127.0.0.1:8080/api/instances

possible output:

[
    {
        "host": "127.0.0.1",
        "name": "local_device",
        "port": 4212,
        "responseTime": 0,
        "state": "paused",
        "title": "https://mp3l.jamendo.com/?trackid=1161920&format=mp31&from=app-3dce8b55",
        "volume": 256
    },
    {
        "host": "0.0.0.0",
        "name": "fail_test",
        "port": 0,
        "responseTime": -1,
        "state": "undefined",
        "title": "no title",
        "volume": -1
    }
]

reconnect

Reconnects all player instances.

Command: POST http://127.0.0.1:8080/api/instances/reconnect


Single Instance Service

Outputs all infos about all player instances as JSON.

Command: GET http://127.0.0.1:8080/api/instances/single/<instanceName>

Parameter:

  • instanceName: Name of the instance as provided in player.json

possible output (for GET http://127.0.0.1:8080/api/instances/single/local_device):

[
    {
        "host": "127.0.0.1",
        "name": "local_device",
        "port": 4212,
        "responseTime": 0,
        "state": "paused",
        "title": "https://mp3l.jamendo.com/?trackid=1161920&format=mp31&from=app-3dce8b55",
        "volume": 256
    }
]

instance play

Starts playing on a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/play

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance pause

Pauses a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/pause

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance stop

Stops playing on a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/stop

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance reset

Restarts current title on a special player instance.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/reset

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance backward

Plays previous title on a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/backward

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance shuffle

Toggles shuffle on a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/shuffle

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance fullscreen

Toggles full screen on a special player instances.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/fullscreen

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance repeat

Toggles repeat on a special player instances

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/repeat

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance forward

Plays next tile on a special player instances

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/forward

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance state

Outputs the current state of the special player instance.

Command: GET http://127.0.0.1:8080/api/instances/single/<instanceName>/state

Parameter:

  • instanceName: Name of the instance as provided in player.json

instance volume

Shows the volume of a special player instance.

Command: POST GET://127.0.0.1:8080/api/instances/single/<instanceName>/volume

Parameter:

  • instanceName: Name of the instance as provided in player.json

Sets the volume of a special player instance.

Command: POST http://127.0.0.1:8080/api/instances/single/<instanceName>/volume

Parameter:

  • instanceName: Name of the instance as provided in player.json


Server Service

Shows all endpoints with server information.

Command: GET http://127.0.0.1:8080/api/server


Host

Shows all host adresses of the server. The qr value is a link to a qr code with a link to this host address.

Command: GET http://127.0.0.1:8080/api/server/host

possible output:

[
    {
        "host": "http://1.2.3.4:8080",
        "qr": "http://127.0.0.1:8080/api/server/host/0"
    },
    {
        "host": "http://[abcd:0:0:0:0:abcd:abcd:abcd]:8080",
        "qr": "http://127.0.0.1:8080/api/server/host/1"
    }
]

Command: GET http://127.0.0.1:8080/api/server/host/0

possible output: QR code representation of host address 0