Skip to content
Snippets Groups Projects
README.md 1.23 KiB
Newer Older
Harpo Roeder's avatar
Harpo Roeder committed
# Polycentric HTTP Bridge

The Polycentric HTTP Bridge allows programmatic control of a Polycentric client via a REST API.
Harpo Roeder's avatar
Harpo Roeder committed

Harpo Roeder's avatar
Harpo Roeder committed
## Configuration

```bash
export POLYCENTRIC_HTTP_BRIDGE_PORT=... # default 5005
export POLYCENTRIC_HTTP_BRIDGE_STATE_DIRECTORY=... # default ./state
```

## Build Quick start
Harpo Roeder's avatar
Harpo Roeder committed

```bash
git clone --recursive git@gitlab.futo.org:polycentric/polycentric.git
./build-vendored.sh
npm install
npm run build
npm start
```
Harpo Roeder's avatar
Harpo Roeder committed

## API

```bash
# Set Username
Harpo Roeder's avatar
Harpo Roeder committed
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/username --data 'Polycentric HTTP Bridge'
# Set Description
Harpo Roeder's avatar
Harpo Roeder committed
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/description --data 'I am a bridge'
Harpo Roeder's avatar
Harpo Roeder committed
# Add Server
Harpo Roeder's avatar
Harpo Roeder committed
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/server --data 'https://srv1-prod.polycentric.io'
Harpo Roeder's avatar
Harpo Roeder committed
# Remove Server
Harpo Roeder's avatar
Harpo Roeder committed
curl -H 'Content-Type: text/plain' -X DELETE http://localhost:5005/server --data 'https://srv1-prod.polycentric.io'
Harpo Roeder's avatar
Harpo Roeder committed
# Post
Harpo Roeder's avatar
Harpo Roeder committed
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/post --data 'Hello World!'
# Get a Polycentric link to this System
curl http://localhost:5005/link
Harpo Roeder's avatar
Harpo Roeder committed
# Set Avatar
curl -H 'Content-Type: application/octet-stream' -X POST http://localhost:5005/avatar --data-binary @avatar.jpg
Harpo Roeder's avatar
Harpo Roeder committed
```