If you want to implement the SpaceAPI for your hackerspace you need to do the following:
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" ] }
To make sure that your SpaceAPI endpoint is compatible with webapps, verify that your server:
Access-Control-Allow-Origin
header to *
. See CORSIf 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.
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.