Clone this wiki locally
OneBody doesn't have much of an API yet, but there are plans for building one.
It is possible to script operations within OneBody using curl or whatever (this script is an example of doing that). To make that a bit easier, we support HTTP Basic authentication, explained below.
Every call to the API requires http basic authentication:
- Username is the email address of a user with super admin privileges.
- Password is their API key
You can specify basic auth with curl with the switch
-u, like so:
curl -u firstname.lastname@example.org:APIKEYHERE http://onebody.yoursite.com/...
Getting an API Key
To create an API key, you can use the Rails console:
- If you installed with the deb package:
onebody run rails console me = Person.where(email: 'email@example.com').first me.api_key = SecureRandom.hex(25) # 50 hex digits me.save!
- Other installation methods:
bundle exec rails console me = Person.where(email: 'firstname.lastname@example.org').first me.api_key = SecureRandom.hex(25) # 50 hex digits me.save!
If you need to check someone's email+password against OneBody to sign them into a separate app, use the Authentication API.