Amber documentation¶
Amber is a python library that provides object orientated interface to REST APIs like Tastypie.
Installation¶
$ pip install -e hg+https://bitbucket.org/ad3w/amber#egg=amber
Examples¶
First create the your amber api instance:
api = amber.Api('http://localhost:8000/api/v1/', ('username', 'password'))GET:
api.get('entry') # get all entries api.get('entry', 1) # get entry with id == 1POST:
api.post('entry', {'title': 'Hello', 'content': 'Hello, world!'}) # create a new entryPUT:
data = { 'title': 'New title', 'content': 'New content', } api.put('entry', 1, data) # update entry with id == 1PATCH:
api.patch('entry', 1, {'title': New title'}) # partially update entry with id == 1DELETE:
api.delete('entry') # delete all entries api.delete('entry', 1) # delete entry with id == 1Fetch URI:
api.uri('entry', 1) # fetch URI of this object