Fullscreen on/off iPad Touch Mobile

Managing categories

Although each measure stands alone it is also important to be able to associate measures with each other and to provide a hierarchy to help organise them.

The primary properties of a category are its name, description and if applicable the id of its parent category. Querying the list of categories and creating a category is handled just like measures:

$ curl -n http://api.ivyroot.com/api/categories
[{"name":"My activity","parent_category":null,"uri":"/categories/6","child_categories":[],"user":"api","starred":0,"id":6}]
$ curl -n http://api.ivyroot.com/api/categories -d "name=MyCategory&description=Stuff I like to categorize"
{"name":"MyCategory","parent_category":null,"uri":"/categories/8","child_categories":[],"user":"api","starred":false,"id":8}

And to create a category associated with a parent you do:

$ curl -n http://api.ivyroot.com/api.1/categories -d "name=ChildCategory2&parent_category=8"
{"id":10,"user":"api"}
$ curl -n http://api.ivyroot.com/api/categories/10
{"name":"ChildCategory2","parent_category":"/categories/8","uri":"/categories/10","child_categories":[],"user":"api","starred":0,"id":10}

You cannot set the child_categories through the API only the parent_category. You also cannot set the parent of a category so that a loop of parent to child relationships would be created.

Next: Connecting measures and categories