Skip to content
On this page

Getting started

This section will help you try Raspberry API in no time. Buckle up, let's go!

Quick deployment

WIP

Manual send

Download the latest release.

INFO

The release (eg. binary) is the file starting with raspberryapi.

Extract binary:

bash
# !!! WARNING -> change values with yours !!!
BIN_VERSION = 1.0.0
LOCAL_PATH = /path/to/binary
USER = your-pi-user-name
IP = 192.162.10.8

# extract binary
scp "$LOCAL_PATH"/raspberryapi_"$BIN_VERSION"_linux_armv5.tar.gz "$USER"@"$IP":/home/"$USER"
ssh "$USER"@"$IP_ADDRESS"
gunzip raspberryapi_"$BIN_VERSION"_linux_armv5.tar.gz
tar xvf raspberryapi_"$BIN_VERSION"_linux_armv5.tar
chmod 755 rpi

Create config file:

bash
# create config file
sudo mkdir /etc/raspberryapi
cd /etc/raspberryapi
sudo vi raspberryapi.yaml

Add the following content:

bash
server:
    port: :3333
    debug: true
    read_timeout_seconds: 30
    write_timeout_seconds: 15

Start API:

bash
# start
USER = your-pi-user-name
cd /home/"$USER"
./rpi

Call the API

Query the hosts endpoint as follow from any client (another Pi terminal, your local machine terminal, Postman, etc.):

bash
# From a Pi terminal:
curl http://localhost:3333/v1/hosts

# From another client:
curl http://IP:3333/v1/hosts

You should see something similar to the following:

json
{
    "raspModel": "Pi Zero+",
    "hostname": "my-raspberry-pi",
    "upTime": 1878622,
    "bootTime": 1672867681,
    "os": "darwin",
    "platform": "darwin",
    "platformFamily": "Standalone Workstation",
    "platformVersion": "13.0.1",
    "kernelVersion": "22.1.0",
    "kernelArch": "x86_64",
    ...
}