From the course: Building and Securing RESTful APIs in ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Discoverable queries using forms

Discoverable queries using forms - ASP.NET Core Tutorial

From the course: Building and Securing RESTful APIs in ASP.NET Core

Start my 1-month free trial

Discoverable queries using forms

- [Instructor] Earlier in the course, we created a sort and search syntax that could be used to query collections. The sort or search parameters are sent to the collection as GET query string parameters like this. The client might send slash rooms, orderBy equals rate, or to search, they might say slash rooms, search name starts with Oxford, or any combination of these. This may not look like a form at first glance, but query string parameters in a GET are a form just like parameters in a POST body are. In order to describe the sort and search syntax and make it discoverable for clients, we can model it as an Ion form and attach the form to the collection response. When we're done, it'll look something like this. Just like other forms, this form will have an href, it'll have a method, which in this case is GET. The query-form relation will be used to indicate what type of form this is to the client, and, in the value property, will describe the different search and sort syntaxes that…

Contents