Project

General

Profile

User documentation

Operations

Lavoisier is providing the following operations :

operation description example
lavoisier GET the view 'example' /lavoisier/example
notify TRIGGER a cache refresh of a view 'example' /notify/example
resource GET a resource available in lavoisier jar /resource/rsc/categories.xml

URL format

The URL format depends on how the services are defined by the Lavoisier administrator.

The 'accept' query field, a reserved keyword

A simple Lavoisier request for the view 'example' is : lavoisier/example. But you may want to apply different rendering than the one used by default, indeed Lavoisier will always apply a default rendering. Nothing more simple, just add an "accept" query field set with a MIME Type or its corresponding extension (e.g. yaml, html, cvs, json):

or

Lavoisier will do its best to apply the requested rendrer through "accept" query field. For a list of supported MIME Types, please see view mime.

Notice :

If you choose an accept value which is matching to the original view format, Lavoisier will ignore your request.

Default case : apply an xpath on the XML feed

By default you can apply an xpath after the view name in the url to select a node of your XML document. Indeed in Lavoisier every data is XML.

Notice :

result is encapsulated by a parent tag to ensure a valid XML format in case of a node set as a result

REST classic url format (path-template)

If administrator of the lavoisier service you use has defined this behaviour, you will no more able to use xpath in the url. You will have to set parameters expected by the service. By example parameters can be used as a input of processors applied to the dataview. In the following example you are forced to pass the first and the second parameter, only the last one can be optional. In this example, url format is following this template : /{width}/{height}/{color=red}

Consequently you can write following request :

/lavoisier/rectangle/800/600
/lavoisier/rectangle/80/60/green

But NOT the following one, an exception is raised because "width" and "height" parameters are not optional :

/lavoisier/rectangle

Exception: User path does not match path template

Notice :

path-template can't be used with cached dataview

Classic HTTP request methods: GET and POST

Using query fields (GET)

All parameters are optional et can be set independently whitout following any order.

/lavoisier/logo
/lavoisier/logo?ratio=200&hair=gold

Using body message (POST)

curl -d ratio=200 -d hair=gold /lavoisier/logo

Using body message AND query fields (POST and GET)

You can use method together, POST values will be overriden.

curl -d ratio=200 -d hair=gold /lavoisier/logo?jacket=brown

Notices :

  • "accept" and "login" are a reserved keyword
  • query fields can't be used with cached dataview

API use cases

cUrl

man

$ curl http://ccleol:8080/lavoisier/example

PHP

SimpleXML

// get as XML to  SimpleXMLElement object
$data = new SimpleXMLElement("http://localhost:8080/lavoisier/example?accept=xml", 0, true);
var_dump($data->asXML());

Java

lavoisier service