diff --git a/.travis.yml b/.travis.yml index 72fa0ff..619b8b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,18 +10,20 @@ python: sudo: required install: - - sudo apt-get update - - sudo apt-get install -y portaudio19-dev python-all-dev --no-install-recommends - - sudo apt-get install -y lilv-utils calf-plugins guitarix --no-install-recommends - - sudo apt-get install -y libavahi-compat-libdnssd1 --no-install-recommends - - pip3 install coveralls - - pip3 install git+https://github.com/depl0y/pybonjour-python3 - - pip3 install zeroconf - - python3 setup.py develop + - make install-develop-requirements + - make install-tests-requirements + - python setup.py develop script: - lv2ls - - coverage3 run --source=webservice wstest/config.py test + - make test after_success: - - 'bash <(curl -s https://codecov.io/bash)' + - bash <(curl -s https://codecov.io/bash) + +jobs: + include: + - stage: doc + script: + - make install-docs-requirements + - make docs diff --git a/CHANGES b/CHANGES index 0138190..862dc4c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,14 +1,35 @@ +Version 0.4.0 - released 05/dd/18 +================================= + + - Issue #45 - Add Makefile + - Issue #44 - Update libraries + + - PluginsManager v0.4.0? -> v0.7.0 + - Application v0.2.0 -> v0.4.0 + + - Issue #33 - Add auth + + - Breaking change! + - See http://pedalpi.github.io/WebService/ for details + - Components that uses WebService can be use WSParameters.COMPONENT_USERNAME and WSParameters.COMPONENT_PASSWORD for auth + + - Improve errors when is not passed all parameters + Version 0.3.0 - released 05/31/17 ================================= - - Issues #31 - Using logging instead print - - Issues #26 - Implemented secure close ([Application issue 29](https://github.com/PedalPi/Application/issues/29) version 0.3.0) - - Issues #27 - Rename zeroconf device name + + - Issue #31 - Using logging instead print + - Issue #26 - Implemented secure close ([Application issue 29](https://github.com/PedalPi/Application/issues/29) version 0.3.0) + - Issue #27 - Rename zeroconf device name - Improve Component Data documentation - Fix '#' problem when request plugin data - Issue #40 - Add support for plugins manager v0.5.0 and Application v0.3.0 + - Now using PluginsManager notification implementation (``with observer:``) + - Issue #37 - Banks swap -> Bank move Version 0.2.0 - released 05/13/17 ================================= + - Initial release diff --git a/README.rst b/README.rst index 776b06a..671c9fc 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,7 @@ The registration must occur before application initialization (``application.sta application = Application(path_data="data/", address='localhost') from webservice.webservice import WebService - application.register(WebService(application, port)) + application.register(WebService(application, port=3000)) 2. Initialization of the web server +++++++++++++++++++++++++++++++++++ @@ -122,7 +122,7 @@ look like the following code: application = Application(path_data="data/", address='localhost') from webservice.webservice import WebService - application.register(WebService(application, port)) + application.register(WebService(application, port=3000)) application.start() @@ -163,17 +163,20 @@ Maintenance Documentation ************* +Is necessary to install `nodejs`_. + +.. _nodejs: https://nodejs.org/en/ + .. code-block:: bash # Installing dependencies - npm install -g aglio + make install-docs-requirements # Generate doc - cd docs/ - aglio -i documentation.apib --theme-variables streak --theme-template triple -o index.html + make docs # View documentation - firefox index.html + make docs-see Test **** @@ -185,5 +188,5 @@ Test coverage3 run --source=webservice wstest/config.py test coverage3 report - coverage3 html - firefox htmlcov/index.html + make test-details + diff --git a/docs/index.html b/docs/index.html index f0a0ea1..4ec379e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,30 +1,57 @@ -Pedal PI - WebService - API documentation

Pedal PI - WebService - API documentation

Pedal Pi - WebService is a Pedal Pi component that offers a Pedal Pi management over REST + WebSocket. This documentation describes the REST API.

-

Authentication

Authentication has two purposes: Control access and obtaining token request identifier

-

Control access

Not implemented

-

Token identifier

With a token identifier, it is possible to send changes if they are identified, so that no notifications of their own changes to WebSocket occur.

-

When a connection is established with http://pedalpi.local/ws, a TOKEN message ("type": "TOKEN") returns a uuid4 for the client.

+Pedal PI - WebService - API documentation

Pedal PI - WebService - API documentation

Pedal Pi - WebService is a Pedal Pi component that offers a Pedal Pi management over REST + WebSocket. This documentation describes the REST API.

+

Authentication

To access API methods, you must be authenticated. The authenticatetion is based on JWT technology.

+

Control access

POST http://pedalpi.local:3000/v1/auth
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "username": "pedal pi",
+  "password": "pedal pi",
+}
Responses200401
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MjE5ODM1NDZ9.MKT1XRgqa68ADIdH1ro0MkIWwh9mXrNPjz5q5aUhFKc"
+}
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "Invalid username or password"
+}

Authenticate
POST/auth

For auth, send the username and the password as a json object. In this +current version, exists only a username: pedal pi

{
-  "value": "{token uuid4}",
-  "type": "TOKEN"
-}
-

It’s necessary that all requests add the following header parameter.

-
x-xsrf-token: {token uuid4}
-
GET http://pedalpi.local:3000/v1/ws
Requests200
Headers
Content-Type: application/json; charset=UTF-8
x-xsrf-token: {token uuid4}
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
anything

Example request
GET/ws

It’s a example request for a random address

+ "username": "pedal pi", + "password": "pedal pi", +} +
+

The initial password is pedal pi. ~Please, on the first login, change +the password~ (in development)!

+
+

If the data is correct, will be returned the auth token. +You need send it in every request. See a example in the next section.

+
+

The token has a expiration of 7 days from login response time. If the token has +expired, is necessary request auth to obtains a new token.

+
+

How to use auth token

In the requests, is necessary send the auth token in the header with the following stard:

+
Authorization: bearer <token>
+
GET http://pedalpi.local:3000/v1/something
Requestssuccessfulwithout Authorizationinvalid Authorization standarttoken with wrong signaturetoken expired
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MjE5ODM1NDZ9.MKT1XRgqa68ADIdH1ro0MkIWwh9mXrNPjz5q5aUhFKc
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
something
Headers
Content-Type: application/json; charset=UTF-8
Responses401
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "Missing authorization"
+}
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer something eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MjE5ODM1NDZ9.MKT1XRgqa68ADIdH1ro0MkIWwh9mXrNPjz5q5aUhFKc
Responses401
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "Invalid header authorization. The Authorization header not match with the standard `Authorization: bearer <token>`"
+}
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MjE5ODM1NDZ9.MKT1XRgqa68ADIdH1ro0MkIWwh9mXrNPjz5q5aUhFKc
Responses401
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "Signature verification failed"
+}
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1MjE5ODM1NDZ9.MKT1XRgqa68ADIdH1ro0MkIWwh9mXrNPjz5q5aUhFKc
Responses401
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "Signature has expired"
+}

Example request
GET/something

+

The Authorization code error is 401.

+

See the possible errors in right selecting a request.

+

Plugins management

It’s possible obtains the Lv2Plugins data in a json format. Pedal Pi uses lilvlib for parse to json.

-

Plugins

GET http://pedalpi.local:3000/v1/plugins
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Plugins

GET http://pedalpi.local:3000/v1/plugins
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
     "plugins": [
         /* Plugins list */
         {"presets": [], ...},
     ]
-}

Plugins list
GET/plugins

Get all audio plugins installed

-

Reload plugins

PUT http://pedalpi.local:3000/v1/plugins/reload
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+}

Plugins list
GET/plugins

Get all audio plugins installed

+

Reload plugins

PUT http://pedalpi.local:3000/v1/plugins/reload
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "status": "ok"
 }
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "error": "lilv not configured"
-}

Reload plugins
PUT/plugins/reload

Reloads the lv2 plugins data.

+}

Reload plugins
PUT/plugins/reload

Reloads the lv2 plugins data.

To get the audio plugin metadata, you need to install lilv. Check the Lv2EffectBuilder.lv2_plugins_data() method documentation for more details on how to install.

If lilv is not installed, an error (400) is returned.

-

Plugin

GET http://pedalpi.local:3000/v1/plugin/http:/calf.sourceforge.net/plugins/MonoInput
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Plugin

GET http://pedalpi.local:3000/v1/plugin/http:/calf.sourceforge.net/plugins/MonoInput
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "label": "Calf Mono Input",
   "microVersion": 0,
   "bundles": [],
@@ -481,26 +508,30 @@
   "brand": "Calf"
 }
Schema
Not defined
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "error": "Plugin \"https://github.com/ninodewit/SHIRO-Plugins/plugins/larynx\" not installed"
-}

Plugin data
GET/plugin/{uri}

Get a specific audio plugin json by uri identifier.

+}

Plugin data
GET/plugin/{uri}

Get a specific audio plugin json by uri identifier.

Some audio plugins have their uri containing #. To get the plugin data, you need to replace # with %23.

Example:

-

Replace

+
    +
  • Replace
  • +
plugin/http://guitarix.sourceforge.net/plugins/gx_redeye#chump
-

with

+
    +
  • with
  • +
plugin/http://guitarix.sourceforge.net/plugins/gx_redeye%23chump
URI Parameters
HideShow
uri
string (required) Example: http://calf.sourceforge.net/plugins/MonoInput

The plugin URI


Banks management

Manages the banks data.

-

Banks

GET http://pedalpi.local:3000/v1/banks
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Banks

GET http://pedalpi.local:3000/v1/banks
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "banks": {
     "0": {"index": 0, ...},
     "1": {"index": 0, ...}
   }
-}

List banks
GET/banks

Get all banks

+}

List banks
GET/banks

Get all banks


Bank management

Bank

Manages a bank: creates a new, update, get the bank data or removes it.

-
POST http://pedalpi.local:3000/v1/bank
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+
POST http://pedalpi.local:3000/v1/bank
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "index": -1,
   "name": "My new bank",
   "pedalboards": [
@@ -518,12 +549,13 @@
 

It’s necessary updates the (client) bank data with the returned index.

-

Manages a bank by index

GET http://pedalpi.local:3000/v1/bank/1
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Manages a bank by index

GET http://pedalpi.local:3000/v1/bank/1
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "index": 1,
   "pedalboards": [
     {
       "connections": [
         {
+          "type": "audio",
           "input": {
             "index": 0,
             "effect": 0,
@@ -535,6 +567,7 @@
           }
         },
         {
+          "type": "audio",
           "input": {
             "index": 0,
             "symbol": "playback_1"
@@ -605,10 +638,10 @@
   ],
   "name": "My awesome bank"
 }
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Get by index
GET/bank/{bank_index}

Request a bank data with the bank index.

+ "error": "list index out of range" +}

Get by index
GET/bank/{bank_index}

Request a bank data with the bank index.

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

-

PUT http://pedalpi.local:3000/v1/bank/1
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

PUT http://pedalpi.local:3000/v1/bank/1
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "index": -1,
   "name": "My new bank",
   "pedalboards": [
@@ -620,15 +653,15 @@
     }
   ]
 }
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
+  "error": "list index out of range"
 }

Update by index
PUT/bank/{bank_index}

Update a bank

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

-

DELETE http://pedalpi.local:3000/v1/bank/1
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Delete by index
DELETE/bank/{bank_index}

Delete a bank

+

DELETE http://pedalpi.local:3000/v1/bank/1
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "list index out of range"
+}

Delete by index
DELETE/bank/{bank_index}

Delete a bank

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index


Pedalboard management

Manages a pedalboard: creates a new, update, get the pedalboard data or removes it.

-

Pedalboard

POST http://pedalpi.local:3000/v1/bank/1/pedalboard
Requests201
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Pedalboard

POST http://pedalpi.local:3000/v1/bank/1/pedalboard
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "name": "My new pedalboard",
   "effects": [],
   "connections": [],
@@ -641,29 +674,29 @@
 

The pedalboard does not have an identifier, the returned index is only for listing and sorting purpose.

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

-

Manages a pedalboard by index position

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Manages a pedalboard by index position

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "name": "My new pedalboard",
   "effects": [],
   "connections": [],
   "data": {}
 }
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}

Request a pedalboard data with the your index (pedalboard position in bank pedalboards list).

+ "error": "list index out of range" +}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}

Request a pedalboard data with the your index (pedalboard position in bank pedalboards list).

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

-

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Requests200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "name": "My new pedalboard",
   "effects": [],
   "connections": [],
   "data": {}
 }
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
+  "error": "list index out of range"
 }

Update by index position
PUT/bank/{bank_index}/pedalboard/{pedalboard_index}

Update a pedalboard

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

-

DELETE http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Delete by index position
DELETE/bank/{bank_index}/pedalboard/{pedalboard_index}

Delete a pedalboard

+

DELETE http://pedalpi.local:3000/v1/bank/1/pedalboard/3
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "list index out of range"
+}

Delete by index position
DELETE/bank/{bank_index}/pedalboard/{pedalboard_index}

Delete a pedalboard

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list


Pedalboard Data management

Manages a custom data for a specified pedalboard.

@@ -692,14 +725,14 @@ } } } -

Manages by key

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/data/pedalpi-apk
Requests200200
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Manages by key

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/data/pedalpi-apk
Requestswith contentpossibly without content
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "effectPositions": [
     {
       "x": 159.74801635742188,
       "y": 91.4995002746582
     }
   ]
-}
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{}

Get by key
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/data/{key}

Request a param data with the your position

+}
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{}

Get by key
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/data/{key}

Request a param data with the your position

If the request with a key that not data has been not persisted yet, the response returns a empty json object:

{}
@@ -707,7 +740,7 @@
URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

key
string (required) Example: pedalpi-apk

Key identifier for data

-

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/data/pedalpi-apk
Requests200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/data/pedalpi-apk
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "effectPositions": [
     {
       "x": 159.74801635742188,
@@ -725,7 +758,7 @@
 

For update effect data, view current toggle status effect and update param data.

-

Effect data

POST http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect
Requests201
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Effect data

POST http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "active": true,
   "params": [
     {
@@ -775,7 +808,7 @@
 
URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard index (position)

-

Manages a effect by index position

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Manages a effect by index position

GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "active": true,
   "params": [
     {
@@ -817,14 +850,14 @@
   "plugin": "http://drobilla.net/plugins/fomp/cs_chorus1",
   "technology": "lv2"
 }
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}

Request a effect data with the your index (effect position in pedalboard effects list).

+ "error": "list index out of range" +}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}

Request a effect data with the your index (effect position in pedalboard effects list).

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

effect_index
number (required) Example: 2

Effect position in pedalboard effects list

-

DELETE http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Delete by index position
DELETE/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}

Delete a effect

+

DELETE http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "list index out of range"
+}

Delete by index position
DELETE/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}

Delete a effect

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

effect_index
number (required) Example: 2

Effect position in pedalboard effects list

@@ -832,28 +865,29 @@

Manages a param by index position

Params contains a index attribute, but the requests needs the index position in params list.

-
GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2/param/0
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+
GET http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2/param/0
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200400
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "maximum": 30,
   "minimum": 0,
   "value": 17,
   "symbol": "delay",
   "index": 2
 }
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
-}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}/param/{param_index}

Request a param data with the your position

+ "error": "list index out of range" +}

Get by index position
GET/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}/param/{param_index}

Request a param data with the your position

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

effect_index
number (required) Example: 2

Effect position in pedalboard effects list

param_index
number (required) Example: 0

Param position in effect params list

-

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2/param/0
Requests200
Headers
Content-Type: text/plain
Body
1.1901190476159431
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
-  "error": "Invalid index"
+

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/effect/2/param/0
Requestsexample 1
Headers
Content-Type: text/plain
Authorization: bearer <auth token>
Body
1.1901190476159431
Responses200400
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+  "error": "list index out of range"
 }

Update by index position
PUT/bank/{bank_index}/pedalboard/{pedalboard_index}/effect/{effect_index}/param/{param_index}

Update a pedalboard

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

effect_index
number (required) Example: 2

Effect position in pedalboard effects list

param_index
number (required) Example: 0

Param position in effect params list


Effect connections management

Connect and disconnect effects.

-

Manages by key

POST http://pedalpi.local:3000/v1/bank/1/pedalboard/3/connect
Requestsexample 1example 2
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Manages by key

POST http://pedalpi.local:3000/v1/bank/1/pedalboard/3/connect
Requestsconnection between effect and system portconnection between effects ports
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
+  "type": "audio",
   "output": {
     "effect": 0,
     "symbol": "out",
@@ -863,7 +897,8 @@
     "symbol": "playback_2",
     "index": 1
   }
-}
Responses200
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+}
Responses200
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
+  "type": "audio",
   "output": {
     "effect": 0,
     "symbol": "out",
@@ -877,7 +912,7 @@
 }
Responses200
This response has no content.

Add a new connection
POST/bank/{bank_index}/pedalboard/{pedalboard_index}/connect

Add a new connection between pedalboards

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

-

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/connect
Requestsexample 1example 2
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

PUT http://pedalpi.local:3000/v1/bank/1/pedalboard/3/connect
Requestsconnection between effect and system portconnection between effects ports
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "output": {
     "effect": 0,
     "symbol": "out",
@@ -887,7 +922,7 @@
     "symbol": "playback_2",
     "index": 1
   }
-}
Responses200
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+}
Responses200
This response has no content.
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{
   "output": {
     "effect": 0,
     "symbol": "out",
@@ -905,11 +940,11 @@
 
URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list


Current management

Provides easy access to current pedalboard settings

-

Retrieve current

GET http://pedalpi.local:3000/v1/current
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+

Retrieve current

GET http://pedalpi.local:3000/v1/current
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "bank": 1,
   "pedalboard": 0
-}

Current index
GET/current

Returns the current pedalboard index and your bank index.

-

Manages the current effect

GET http://pedalpi.local:3000/v1/current/data
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
+}

Current index
GET/current

Returns the current pedalboard index and your bank index.

+

Current bank data

GET http://pedalpi.local:3000/v1/current/data
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8
Body
{
   "bank": {
     "index": 2,
     "name": "Rock 80's",
@@ -923,55 +958,67 @@
     ]
   },
   "pedalboard": 0
-}

Current data
GET/current/data

Returns the json data of the bank of the current pedalboard.

-

Manages the current pedalboard

PUT http://pedalpi.local:3000/v1/current/bank/1/pedalboard/3
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Set current pedalboard
PUT/current/bank/{bank_index}/pedalboard/{pedalboard_index}

The the specified pedalboard for the current. The audio processing will be setted for the pedalboard configuration (adding effects and your relationships).

+}

Current data
GET/current/data

Returns the json data of the bank of the current pedalboard.

+

Manages current pedalboard

PUT http://pedalpi.local:3000/v1/current/bank/1/pedalboard/3
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Set current pedalboard
PUT/current/bank/{bank_index}/pedalboard/{pedalboard_index}

Define the current pedalboard based on the specified URI. The audio processing +will be setted for the pedalboard configuration.

URI Parameters
HideShow
bank_index
number (required) Example: 1

Bank index

pedalboard_index
number (required) Example: 3

Pedalboard position in bank pedalboards list

-

Maneges effect status of the current pedalboard

PUT http://pedalpi.local:3000/v1/current/effect/2
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Toggle effect status
PUT/current/effect/{effect_index}

Toggle the status of a effect of the current pedalboard.

+

Maneges effect status of the current pedalboard

PUT http://pedalpi.local:3000/v1/current/effect/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Toggle effect status
PUT/current/effect/{effect_index}

Toggle the status of a effect of the current pedalboard.

Toggle status effect: Changes the status active → bypass or the reverse (bypass → active) for a effect loaded.

URI Parameters
HideShow
effect_index
number (required) Example: 2

Effect position in pedalboard effects list


Move

Move Bank

Use it to changes the order of the banks in banks list.

-
PUT http://pedalpi.local:3000/v1/move/bank/3/to/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Change banks order
PUT/move/bank/{from_index}/to/{to_index}

Change the position of a bank in banks list

+
PUT http://pedalpi.local:3000/v1/move/bank/3/to/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Change banks order
PUT/move/bank/{from_index}/to/{to_index}

Change the position of a bank in banks list

URI Parameters
HideShow
from_index
number (required) Example: 3

Actual bank position in banks list

to_index
number (required) Example: 2

New bank position in banks list


Move Pedalboard

Use it to changes the order of the pedalboards of a bank.

-
PUT http://pedalpi.local:3000/v1/move/bank/1/pedalboard/3/to/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Change order of a pedalboard in your bank
PUT/move/bank/{bank_index}/pedalboard/{from_index}/to/{to_index}

Change the position of a pedalboard in your bank

+
PUT http://pedalpi.local:3000/v1/move/bank/1/pedalboard/3/to/2
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Headers
Content-Type: application/json; charset=UTF-8

Change order of a pedalboard in your bank
PUT/move/bank/{bank_index}/pedalboard/{from_index}/to/{to_index}

Change the position of a pedalboard in your bank

URI Parameters
HideShow
bank_index
number (required) Example: 1

Index of Bank that contains the pedalboard

from_index
number (required) Example: 3

Actual pedalboard position in bank pedalboards list

to_index
number (required) Example: 2

New pedalboard position in bank pedalboards list


Configurations

Manages Pedal Pi configurations

-

Device Name

GET http://pedalpi.local:3000/v1/configurations/device_name
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Responses200
This response has no content.

Get device name (zeroconf)
GET/configurations/device_name

Get the device name that will appear in a search performed by zeroconf.

-

Set Device Name

PUT http://pedalpi.local:3000/v1/configurations/device_name/Paulo - Pedal Pi
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Responses200
This response has no content.

Set the device name (zeroconf)
PUT/configurations/device_name/{new_name}

Change the device name that will appear in a search performed by zeroconf.

+

Device Name

GET http://pedalpi.local:3000/v1/configurations/device_name
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Body
{
+  "name": "RaspberryPi"
+}

Get device name (zeroconf)
GET/configurations/device_name

Get the device name that will appear in a search performed by zeroconf.

+

Set Device Name

PUT http://pedalpi.local:3000/v1/configurations/device_name/Paulo - Pedal Pi
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
This response has no content.

Set the device name (zeroconf)
PUT/configurations/device_name/{new_name}

Change the device name that will appear in a search performed by zeroconf.

URI Parameters
HideShow
new_name
string (required) Example: Paulo - Pedal Pi

New device name

-

Component data

In addition to the possibility of persisting additional data for a particular pedalboard, it is possible to persist isolated data, that is, they do not share the same storage space with pedalboards.

+

Component data

In addition to the possibility of persisting additional data for a specific pedalboard, it’s possible to persist isolated data, that is, they do not share the same storage space with pedalboards.

Manage data

Access to the data is through a key. This key must be unique: more than one component using the same key will result in the same storage space for both.

It is expected, although not mandatory, that data from a component using this API have a unique key.

-
GET http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1No data previously saved
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Body
{
+
GET http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1no data previously saved
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Body
{
   "a key": "a value"
-}
Headers
Content-Type: application/json; charset=UTF-8
Responses200
Body
{}

Get component data
GET/data/{key}

Get the current data persisted for the informed key. If any data has previously persisted, returns a empty dict ({}).

+}
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
Body
{}

Get component data
GET/data/{key}

Get the current data persisted for the informed key. If any data has previously persisted, returns a empty dict ({}).

URI Parameters
HideShow
key
string (required) Example: MyAwesomeComponent

Data component identifier. In format [a-zA-Z-0-9]+

-

PUT http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Body
{"current-data": {"name": "test"}, {"value": [1, 2, 3]}}
Responses200
This response has no content.

Set component data
PUT/data/{key}

Persists a data for the informed key.

+

PUT http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Body
{"current-data": {"name": "test"}, {"value": [1, 2, 3]}}
Responses200
This response has no content.

Set component data
PUT/data/{key}

Persists a data for the informed key.

All current content is replaced by new.

When adding a new data, remember to stick with what has already been persisted.

URI Parameters
HideShow
key
string (required) Example: MyAwesomeComponent

Data component identifier. In format [a-zA-Z-0-9]+

-

DELETE http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Responses200
This response has no content.

Clear component data
DELETE/data/{key}

Removes the current data persisted for the informed key.

+

DELETE http://pedalpi.local:3000/v1/data/MyAwesomeComponent
Requestsexample 1
Headers
Content-Type: application/json; charset=UTF-8
Authorization: bearer <auth token>
Responses200
This response has no content.

Clear component data
DELETE/data/{key}

Removes the current data persisted for the informed key.

Be cautious and do not erase data from other components that you are not managing.

URI Parameters
HideShow
key
string (required) Example: MyAwesomeComponent

Data component identifier. In format [a-zA-Z-0-9]+


WebSocket

Pedal Pi - WebService uses WebSockets to receive notification of changes made by other clients. For example, consider a Pedal Pi configured with the Raspberry-P0 and WebSocket components, when the user presses a button to change the current pedalboard, WebService clients will be notified that the status of the application has changed via their WebSocket connections.

-
-

In order for a client to not receive notifications of state changes made by the client itself, TOKEN identifier must be passed in the header.

+

Register client

After the connection is stabilised, is necessary request the self register using +the auth token. Send to server:

+
{
+  "register": "<token>"
+}
+

After the sucessful registration, the client will be receive notifications. +In the next section they will be presented.

+
+

After the auth token expires, when occurs any update, will be sent to the client +a message error instead the data:

+
{"error": "Token has been expired. Your data now is possibly unsynchronized"}

WebSocket notification messages

Notification messages have a type field that determines the type of notification. EFFECT-TOGGLE, for example, informs that the notification refers to changing the current state of an effect (whether it is active or not).

Some message types have an updateType field to tell you what type of update occurred. The accepted values ​​for updateType are CREATED, UPDATED and DELETED. A type=CONNECTION message with updateType=DELETED indicates that a connection (which is described in the other fields of the message) has been removed.

-

For implementation details, check updates_observer_socket.py.

+

For implementation details, check websocket_connection_observer.py.

Notification on_current_pedalboard_changed

-

Generated by aglio on 28 May 2017