!!! Mediawiki has been upgraded !!!
Slack integration has been disabled for now due to an incompatibility.
If you want to testdrive the new skin (Tweeki), make sure your language settings are set to 'en - English' in your preferences!

SpaceAPI

From Brixel - Hackerspace Hasselt
Jump to: navigation, search


Project: Space API
350x350px
Description: Implementing the SpaceAPI in our hackerspace
Status: In progress
Participants: Berend
Projectcode: https://github.com/Brixel/SpaceAPI.Clients
Expertise: API, php, HTML
Edit tags: SpaceAPI


What

The Space API is a worldwide API that hackerspace can implement in their infrastructure to announce if they are open or not. Since we've been thinking about this a while, I started to implement the API.

First steps

  • Connecting to the API

This has been done, and is working properly. At this moment the code resides in Azure. To get the status from the api, take a look at this URL: https://spaceapi.azurewebsites.net/api/Status In the response you'll find a "state"."open":false object, this show the current state.

   "api": "0.13",
   "space": "Brixel",
   "logo": "http:\/\/wiki.brixel.be\/images\/Brixel_Logo.png",
   "url": "http:\/\/brixel.be",
   "location": {
       "address": "Spalbeekstraat 34, 3510 Spalbeek, Belgium",
       "lon": 5.2305834,
       "lat": 50.9509978
   },
   "spacefed": {
       "spacenet": false,
       "spacesaml": false,
       "spacephone": false
   },
   "contact": {
       "twitter": "@hs_hasselt",
       "email": "info@brixel.be",
       "irc": "irc:\/\/irc.freenode.net\/brixel",
       "ml": "brixel-public@discuss.brixel.be"
   },
   "issue_report_channels": ["email"],
   "state": {
       "open": true
   },
   "projects": ["http:\/\/wiki.brixel.be\/w\/Category:Projects"],
   "cache": {
       "schedule": "d.01"
   }
  • Administrative tool

The current API is written in C#, powered by Web API 2, and a SQL-database. This means initial request might take a while, the subsequent ones should respond faster.

Azure

The current API is hosted in on Azure. Hosted on a (semi-experimental) API-service, the application is written in C#. Logging is also implemented in the current version. For the latest controller actions, take a look at: https://spaceapi.azurewebsites.net/swagger/ui/index

Buttons

Near the door, there are two buttons. These don't do anything. The actual spaceAPI button is now embedded in an ESP8266-box created by Alex, and does the api calls. Also the LED-ring shows the colour based on the status of the API.

  • The note still applies, but this time it's the ESP acting strange.

Device

The buttons are being controlled by an ESP8266.

Security and authentication

Due to the nature of the API - it has internet facing endpoints - some API endpoints require authentication. A typical solution in this case is the use of OAuth2 to handle authentication. A well known OAuth2 implementation (written in C#, because the API is also written in C#) is IdentityServer. The 4th version of this implementation is running on .NET Core, allowing it to run everywhere.

Note

This API is also known as Schrödinger's API, because the buttons act weird.

Slack integration

Since 16-05-2016 our Slack-channel has a integration with the SpaceAPI. Just hit /space in any channel on Slack and you'll get a response from the SpaceAPI telling you if we're open or not.