SpaceAPI

Getting Started

If you want to implement the SpaceAPI for your hackerspace you need to do the following:

Hosting

The most minimal solution is to just statically host the JSON file on your own server.

A most minimal JSON file with just the required fields looks like that:

{
  "api": "0.13",
  "space": "$foospace",
  "logo": "https://foospace.example.com/logo.png",
  "url": "https://foospace.example.com",
  "location": {
    "lon": 1.337,
    "lat": 42.001
  },
  "state": {
    "open": null
  },
  "contact": {
    "email": "info@foospace.example.com"
  },
  "issue_report_channels": [
    "email"
  ]
}

Common Issues

To make sure That your SpaceAPI endpoint is compatible with webapps, verify that your server:

  • Is reachable by TLS/HTTPS. See Mixed content
  • Sets the Access-Control-Allow-Origin header to *. See CORS

Dynamic Hosting

If you want to support dynamic data in your API like sensor values, you need a way to update the JSON data. While you could just change the values in your statically hosted file, this may be impractical especially if you have values that change a lot.

There are different implementation of servers which serve the SpaceAPI and provide an API to update sensor values. See the SpaceAPI Community repositories or the Apps page for some examples.

Validation

You can use the SpaceAPI validator to verify that you implement it correctly. It doesn't catch all issues and only works if your endpoint is reachable by HTTPS and sets the CORS headers correctly. See Common Issues.