This repository has been archived by the owner on Mar 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 283
API
TechWilk edited this page Jul 7, 2016
·
5 revisions
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 [email protected]:APIKEYHERE http://onebody.yoursite.com/...
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 protected]').first
me.api_key = SecureRandom.hex(25) # 50 hex digits
me.save!
- Other installation methods:
bundle exec rails console
me = Person.where(email: '[email protected]').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.