Templated Links
WARNING
This API is frozen and deprecated. Please use the fluent API from 0.9.4 on
When a resource's _links
object contains templated links, you provide the values to fill the template using the template
parameter of the method.
For example, if you have a collection resource for, say customers
resource like this:
{ "_items": [ ... ... ], "_links": { "self: { "href": "/customers" }, "item": { "href": "/customers/{id}", "templated": true } }
You can send a GET
request to the item
rel of the collection by providing an id
to fill the template:
NOTE: when this is a common pattern in hypermea's collection resources. If you have an ID from a previous session and want to
GET
the collection without its_items
populated, you can do this:
customers = api.get_from_rel(root, 'customers', parameters={'where':'{'1':-1}'})
In other words, search for all customers whose1
field is equal to-1
, returning an empty_items