Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A <strong>web browser</strong> is the stateless client most familiar to many users. What you are asking for is known as <em>URI templating</em> and is supported by various hypermedia formats. For example, in HTML:</p> <pre><code>&lt;form action="/api/fruits" method="GET"&gt; &lt;input type="number" name="id" value="1" min="1"&gt; &lt;button type="submit"&gt;Get Fruit&lt;/button&gt; &lt;form&gt; </code></pre> <p>will of course generate GET requests to the URI <code>/api/fruits?id=1</code> when submitted.</p> <p>Other hypermedia formats <a href="https://tools.ietf.org/html/draft-kelly-json-hal" rel="nofollow">such as HAL</a> allow templating anywhere in the URI, and are better suited to web applications than HTML. You need to look into the templating mechanisms supported by your preferred hypermedia representation format or switch to a format that supports what you need.</p> <p>Of course, in HTML due to poor templating, we have to list every desired URI and paginate long lists:</p> <pre><code>&lt;a href="/api/fruits/1/"&gt;Apple&lt;/a&gt; &lt;a href="/api/fruits/2/"&gt;Banana&lt;/a&gt; &lt;a href="/api/fruits/3/"&gt;Citrus&lt;/a&gt; ... &lt;a href="/api/fruits/?page=2" rel="next"&gt;Page 2&lt;/a&gt; </code></pre> <p>To be honest though, if users are going to directly input IDs, you should probably allow HTML and query string parameters too. It will help third-party client developers when they are building against your API, and it's availability will help if you ever need to debug with end users. Just point them to a URL and ask "Does it work if you go here?"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload