Documentation > API

Libraries

There are auto-generated client libraries for Javascript, Ruby, and Python (the auto-gen code is in the Ruby backend).

The libraries all implement a similar interface. JS currently uses a singleton BrisaAPI object, but will be rewritten similar to the Ruby library.

Here is a small sample of the Ruby library usage. Python is exactly the same, except Python syntax :).

# Create a client.
brisa = Brisa.new('http://localhost:3000/brisa', auth_token: 'my_token or blank')

# If you aren't logged in:
auth_token = brisa.User.login('my@email.addr', 'my_password').data['auth_token']
brisa.add_args = {auth_token: auth_token}

# Create an Entry
entry = brisa.Entry.create({title: 'My first entry.', description: 'Hello, Brisa!', tags: 'Important'})
# Update the entry
entry.title = 'My updated entry'
entry.update

# Find entries tagged important
results = brisa.Entry.search('Important', nil)
results.each { |r| puts "#{r.id} #{r.title}" }

The Developer section has more about the structure of entries and building boards with it.


API Overview

Brisa does not use the more popular RESTful API style, prefering a simple RPC-like format for auto-generating libraries.

The backend accepts requests at /brisa. To make development easier, the action is taken as a URL parameter. For example, searching for entries would be a request to /brisa/Entry:search.

Here is a list of API objects and actions with arguments:

  • Entry: { title, description, metadata, tags, classes, created_at, updated_at }
    Entry:search { tags, classes }
    Entry:create { data }
    Entry:update { id, data }
    Entry:add_tags { id, tags }
    Entry:remove_tags { id, tags }
    Entry:edit_class { id, class_name, cfg }
    Entry:destroy { id }
  • User: { alias, admin }
  • User:status { renew }
    User:login { email, password }
    User:logout { }
  • UserSetting: { user_id, name, setting }
  • UserSetting:all { }
    UserSetting:create { name, setting }
    UserSetting:update { id, data }
    UserSetting:destroy { id }
  • Model: { unique_id, title, config }
    Model:all { }
    Model:create { data }
    Model:update { id, data }