Skip to content

A simple API to provide a REST interface to the pins of a Raspberry Pi.

License

Notifications You must be signed in to change notification settings

balena-io-experimental/a-pi-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Pi API (.py)

A simple API to provide a REST interface to the pins of a Raspberry Pi.

a simple breadboard

Getting Started

  1. The first few steps of this are covered by the resin.io getting started guide, tweaked very slightly.
    • Clone and push this repo instead of the getting started repo. Once you get to the bottom of that, come back here.
  2. Configure the fleet with the environment variable AUTH_NONE as asdf. This is not recommended for production, see Authorization section below!
  3. Grab some breadboard, some LEDs and stuff.
  4. Enable PUBLIC DEVICE URL, and visit it; this will take you to the UI which has documents on each endpoint and a Try it out! for each.
  5. You are now reading and controlling real world components over the cloud with an easily upgradeable infrastructure. This could be relays with mains voltage (be careful!) lamps, water level monitors or whatever on/off components you wish!

Endpoint Overview

  • GET an individual pin on /pin/{id}
  • PUT an individual pin on /pin/{id}
  • GET all the pins on /pins
  • PATCH a subset of the pins on /pins
  • GET a ping on /status

Authorization

At the moment this codebase supports the configuring of one shared secret. When a request comes in the codebase will hash the value in the Authorization header and compare this to the provided value.

The best of the following environment variables will be used:

  1. AUTH_SHA256
  2. AUTH_SHA1
  3. AUTH_MD5
  4. AUTH_PLAIN - compares directly, without any one way encryption
  5. AUTH_NONE - instructs the device to allow all requests

Endpoint Details

Full details of endpoints can be found in the swagger spec

About

A simple API to provide a REST interface to the pins of a Raspberry Pi.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published