Difference between revisions of "Talk:Sugar Network/API"

From Sugar Labs
Jump to navigation Jump to search
(Created page with "= Some basic examples for beginning the implementation of basic client = == Browsing a list of contexts == '''Get''' the list: http://localhost/context?offset=0&limit=2&prope...")
(No difference)

Revision as of 10:58, 27 January 2012

Some basic examples for beginning the implementation of basic client

Browsing a list of contexts

Get the list:

http://localhost/context?offset=0&limit=2&properties=title,description,guid&order_by=-mtime

Default order is by modification time.

This would output an array of dictionaries:

[[{key: value}], total]

For example:

[[{'title':'Actividad Navegar',
   'description':'La actividad navegar...',
   'guid':'SOMEHASH'},
  {'title':'Actividad Escribir',
   'description':'La actividad escribir...',
   'guid':'SOMEOTHERHASH'}], 10]

Browsing questions associated with resources

Get:

http://localhost/question?request=guid:SOMEHASH&offset=0&limit=20&properties=title,content,rating,vote,guid&order_by=-mtime

In this example there's only one question associated with this context:

[[{'title':'Se puede añadir un buscador?',
   'content':'Otros navegadores incluyen un buscador...',
   'rating': 0,
   'guid' : 'OTHERHASH',
   'vote': False}], 1]

Modifying a property

Put:

http://localhost/question/OTHERHASH

With sending a dictionary. For instance for voting: {vote: True} (Voting consists only of a boolean, as in +1, or Star)