GithubHelp home page GithubHelp logo

balena-io-experimental / a-pi-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 124 KB

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

License: Other

Dockerfile 3.84% Python 96.16%

a-pi-api's Introduction

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

a-pi-api's People

Contributors

sqweelygig avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.