• We just upgraded the platform on which this website runs! Please inform @Jaxel of any issues.

Implemented External Access to modify Fields via API

Velyks

New member
Hi,

I'm looking to make my own all-in-one streaming control panel with everything possible integrated. To this end I'm looking for a way to send updates to my 8wr.io scoreboard from outside the 8wr.io site. This would allow me to integrate Scoreboard Assistant into things like Stream Decks or Macro Apps for phones.

Ideally using an API key I'd like to be able to make RESTful requests that either retrieve or set values in fields in pages, and the databases of those fields. Personal preference but doing it with json would also be nice.

Functionality I'd like to see:
  • GET field - Returns the current field value in plain text or json
  • POST field - Takes a single value and updates a field
  • GET database - Returns a json list of all values in a field's database
  • POST database - Takes a json list of values and adds them to a database
  • PATCH database - Same as POST database
  • PUT database - Takes a json list of values and replaces a database with them
  • DELETE database - Takes a json list of values and removes them from a database
  • GET page - Returns all the current field values of a page in json

Some possible example calls:
  • Code:
    curl -X GET -H 'authorization: Basic <apikey>' https://8wr.io/api/<scoreboard_id>/<page_id>/<field_id>
  • Code:
    curl -X GET https://8wr.io/api/<scoreboard_id>/<page_id>/<field_id>?api_key=<api_key>
  • Code:
    curl -X GET https://8wr.io/api/<scoreboard_id>/<page_id>/<field_id>/database?api_key=<api_key>
  • Code:
    curl -X POST -d "12" -H "Content-Type: text/plain" https://8wr.io/api/<scoreboard_id>/<page_id>/<field_id>?api_key=<api_key>
  • Code:
    curl -X POST -d "players_1=Steve&players_2=Brian&players_1s=0&players_2s=2" -H "Content-Type: application/x-www-form-urlencoded" https://8wr.io/api/<scoreboard_id>/<page_id>?api_key=<api_key>
  • Code:
    curl -X POST -d '{"players_1": "Steve", "players_2": "Brian", "players_1s": 0, "players_2s": 2}' -H "Content-Type: application/json" https://8wr.io/api/<scoreboard_id>/<page_id>?api_key=<api_key>

Edit: I realise that due to obs-websocket currently not supporting SSL the site doesn't either which would mean API keys would be sent unencrypted, but I still think that even with the potential security issue it's worth doing, it would be a killer feature.
 
Last edited:

Jaxel

Administrator
We use Google Firebase here. So any application which is designed to connect to Firebase can access the data. (It can even edit the data, which is why you should keep your scoreboard and page IDs a secret; they act as your API key)

You can download the Streamdeck extension here if you want to look at the code: