Skip to content
Snippets Groups Projects
user avatar
Harpo Roeder authored
dae9c150
History

Polycentric HTTP Bridge

The Polycentric HTTP Bridge allows programmatic control of a Polycentric client via a REST API.

Configuration

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

Build Quick start

git clone --recursive git@gitlab.futo.org:polycentric/polycentric.git
./build-vendored.sh
npm install
npm run build
npm start

API

# Set Username
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/username --data 'Polycentric HTTP Bridge'
# Set Description
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/description --data 'I am a bridge'
# Add Server
curl -H 'Content-Type: text/plain' -X POST http://localhost:5005/server --data 'https://srv1-prod.polycentric.io'
# Remove Server
curl -H 'Content-Type: text/plain' -X DELETE http://localhost:5005/server --data 'https://srv1-prod.polycentric.io'
# Post
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
# Set Avatar
curl -H 'Content-Type: application/octet-stream' -X POST http://localhost:5005/avatar --data-binary @avatar.jpg