1. New "Remote" API

    Sometimes, it’s nice to be able to open a console or mockup a little script to do some work on the data that lies on the server.

    Some real life examples include:

    1. moving a bunch of objects around
    2. renaming due to new naming conventions
    3. delete many elements
    4. import content from another source (CSV, database, etc)

    To make such operations fun, we have created the Zena::Remote library.

    Zena::Remote

    You can get all the details here, but a small IRB session should give you the gist of it:

    $ irb
    >> require 'zena/remote'
    => true
    >> remote = Zena::Remote.connect("example.com", "super secret token")
    => ...
    >> c = remote['Contact'].new(:title => 'Zumbi', :parent_id=>1)
    => ...
    >> c.save
    => {"fullpath"=>"Zumbi", "position"=>0.0, "klass"=>"Contact", "name"=>"Zumbi", "created_at"=>Mon Aug 30 19:37:10 UTC 2010, "title"=>"Zumbi", "updated_at"=>Mon Aug 30 19:37:10 UTC 2010, "event_at"=>nil, "log_at"=>nil, "v_status"=>50, "id"=>393, "parent_id"=>"1", "node_name"=>"Zumbi", "ref_lang"=>"fr", "kpath"=>"NRCC"}
    >> remote.all("contacts")
    => [...]
    >> remote.delete("contacts where title = 'Zumbi'")
    => [...]
    

    This XML based API is very powerful (you can mass-delete, mass-update, use relations as methods, change links, etc).

    Have fun !

    Gaspard Bucher

    comments

    1. Monday, September 06 2010 13:34 cga

      hi Gaspard,

      this sounds as much great as dangerous to me. exposing such a powerful tool on the interwebs isn’t it a little bit mmmm dangerous?

      unless this is only in admin mode.

      ps: how are the test/development going? you know that i’m craving for 1.0 ;)

      pps: now that RoR 3 is out, will you make Zena RoR 3 dependet only?

    2. Wednesday, September 15 2010 09:03 Gaspard Bucher

      This tool has the same rights as the visitor’s credentials (token) used to login.

      To strengthen security, I added a site setting called “API group” (the visitor must be in this group to use the API). If this setting is empty, then nobody can use the API.

      About your other question, as I said in the mailing list, the roadmap is beta3 this Friday and a 1.0 in October (after we have run some sites in production on the beta).

    3. leave a comment