This example constructs a search form and searchable collection resource. Navigate to this resource from the home via the ‘tenants’ link relation. Then search back on the collection.
Method | link rel | associated route | notes |
---|---|---|---|
GET | / | start at the root of the api which has
tenants
as a link rel |
|
GET | tenants |
/tenant/ | follow the
tenants
link to get the collection |
GET | search |
/tenant/form/search | follow the
search
form to get fields to fill in (this creates a filter in the current implementation) |
POST | submit |
/tenant/search/ | fill in the form and send back to
submit
URL. Response returns
201 Created
with
Location
header |
GET | /tenant/?q= | follow the
Location
header returns a filtered search (feed) collection. Note: this is the same route as
tenants
link rel |
Note: by convention a form can be submitted semantically. The
submit
link rel is usually the first option but it could be back on the originating collection. In this case, because the tenant collection is logically parented on the root rather than on a user (which it probably should but this collection is a convenient collection).
Below, you see on overview of the code, then you see the implementation.
Below, you see on overview of the code, then you see the implementation.
Below, you see on overview of the code, then you see the implementation.
The search here is a simple technique to redirect back to the collection that takes an optional filter.
Below, you see on overview of the code, then you see the implementation.