Skip to content

API Details

Libraries

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

You can download libraries for your language on the Downloads page.

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}" }

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

  Attributes:  title, group_id, owner_uid, creator_uid, description, metadata, tags, classes, created_at, updated_at, comment_count

  Functions:
    find( id )
    updates( since )
    search( tags, classes, group_id )
    create( data )
    update( id, data )
    add_tags( id, tags )
    remove_tags( id, tags )
    edit_class( id, class_name, cfg )
    destroy( id )

User

  Attributes: alias, admin

  Functions:
    status( renew )
    update_account( alias )
    change_pass( password, new_password )
    login( email, password )
    groups( )
    logout( )

Model

  Attributes: owner_uid, group_id, unique_id, title, config )

  Functions:
    all( group_id )
    create( data )
    update( id, data )

UserSetting

  Attributes: user_id, name, setting

  Functions:
    all( )
    create( name, setting )
    update( id, data )
    destroy( id )

Group

  Attributes: name, id, settings, owner_uid, access

  Functions:
    create( name )
    add_share( id, email, access )
    remove_share( id, email )
    shares( id )
    setting( id, name, value )

Role

  Attributes: name

  Functions:
    create( name, password )
    all( )
    destroy( id )
    token( id, password, exp )

Comment

  Attributes: user_uid, comment, metadata, reply_to

  Functions:
    all( entry_id )
    find( id )
    create( data )
    destroy( id )
    update( id, data )