summaryrefslogtreecommitdiffstats
path: root/docs/en/cowboy/2.6/manual/cowboy_rest/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/en/cowboy/2.6/manual/cowboy_rest/index.html')
-rw-r--r--docs/en/cowboy/2.6/manual/cowboy_rest/index.html72
1 files changed, 37 insertions, 35 deletions
diff --git a/docs/en/cowboy/2.6/manual/cowboy_rest/index.html b/docs/en/cowboy/2.6/manual/cowboy_rest/index.html
index 0aa23745..451f356d 100644
--- a/docs/en/cowboy/2.6/manual/cowboy_rest/index.html
+++ b/docs/en/cowboy/2.6/manual/cowboy_rest/index.html
@@ -69,7 +69,7 @@
<p>Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state).</p>
<h2 id="_callbacks">Callbacks</h2>
<p>REST handlers implement the following interface:</p>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -110,7 +110,7 @@ http://www.gnu.org/software/src-highlite -->
</dl>
<h2 id="_rest_callbacks">REST callbacks</h2>
<h3 id="_acceptcallback">AcceptCallback</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -126,7 +126,7 @@ http://www.gnu.org/software/src-highlite -->
<p>For PATCH requests, the body is a series of instructions on how to update the resource. Patch files or JSON Patch are examples of such media types.</p>
<p>A response body may be sent. The appropriate media type, charset and language for the response can be retrieved from the Req object using the <code>media_type</code>, <code>charset</code> and <code>language</code> keys, respectively. The body can be set using <a href="../cowboy_req.set_resp_body">cowboy_req:set_resp_body(3)</a>.</p>
<h3 id="_allowed_methods">allowed_methods</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -137,7 +137,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return the list of allowed methods.</p>
<h3 id="_allow_missing_post">allow_missing_post</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -149,7 +149,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether POST is allowed when the resource doesn&apos;t exist.</p>
<p>Returning <code>true</code> here means that a new resource will be created. The URI for the newly created resource should be returned from the <code>AcceptCallback</code> function.</p>
<h3 id="_charsets_provided">charsets_provided</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -162,7 +162,7 @@ http://www.gnu.org/software/src-highlite -->
<p>During content negotiation Cowboy will pick the most appropriate charset for the client. The client advertises charsets it prefers with the accept-charset header. When that header is missing, Cowboy picks the first charset from the resource.</p>
<!-- @todo We should explain precisely how charsets are picked.-->
<p>Cowboy will add the negotiated <code>charset</code> to the Req object after this step completes:</p>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -172,7 +172,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Note that Cowboy will only append the charset to the content-type header of the response if the media type is text.</p>
<h3 id="_content_types_accepted">content_types_accepted</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -201,7 +201,7 @@ http://www.gnu.org/software/src-highlite -->
<!-- what the method is with `cowboy_req:method/1` and return a-->
<!-- different list for each methods.-->
<h3 id="_content_types_provided">content_types_provided</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -227,7 +227,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Cowboy treats all parameters as case sensitive, except for the <code>charset</code> parameter, which is known to be case insensitive. You should therefore always provide the charset as a lowercase binary string.</p>
<p>When a charset is given in the media type parameters in the accept header, Cowboy will do some additional checks to confirm that it can use this charset. When the wildcard is used then Cowboy will immediately call <code>charsets_provided</code> to confirm the charset is acceptable. If the callback is undefined Cowboy assumes any charset is acceptable. When the wildcard is not used and the charset given in the accept header matches one of the configured media types Cowboy will use that charset and skip the <code>charsets_provided</code> step entirely.</p>
<p>Cowboy will add the negotiated <code>media_type</code> to the Req object after this step completes:</p>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -237,7 +237,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<!-- @todo Case sensitivity of parsed mime content?-->
<p>Cowboy may also add the negotiated <code>charset</code> to the Req object after this step completes:</p>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -246,7 +246,7 @@ http://www.gnu.org/software/src-highlite -->
}</tt></pre>
</div></div>
<h3 id="_delete_completed">delete_completed</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -258,7 +258,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the resource has been fully deleted from the system, including from any internal cache.</p>
<p>Returning <code>false</code> will result in a <em>202 Accepted</em> response being sent instead of a <em>200 OK</em> or <em>204 No Content</em>.</p>
<h3 id="_delete_resource">delete_resource</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -270,7 +270,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Delete the resource.</p>
<p>Cowboy will send an error response when this function returns <code>false</code>.</p>
<h3 id="_expires">expires</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -281,7 +281,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return the resource&apos;s expiration date.</p>
<h3 id="_forbidden">forbidden</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -293,7 +293,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether access to the resource is forbidden.</p>
<p>A <em>403 Forbidden</em> response will be sent if this function returns <code>true</code>. This status code means that access is forbidden regardless of authentication, and that the request shouldn&apos;t be repeated.</p>
<h3 id="_generate_etag">generate_etag</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -305,7 +305,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return the entity tag of the resource.</p>
<p>When a binary is returned, the value is automatically parsed to a tuple. The binary must be in the same format as the etag header, including quotes.</p>
<h3 id="_is_authorized">is_authorized</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -318,7 +318,7 @@ http://www.gnu.org/software/src-highlite -->
<p>This function should be used to perform any necessary authentication of the user before attempting to perform any action on the resource.</p>
<p>When authentication fails, the <code>AuthHeader</code> value will be sent in the www-authenticate header for the <em>401 Unauthorized</em> response.</p>
<h3 id="_is_conflict">is_conflict</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -330,7 +330,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the PUT request results in a conflict.</p>
<p>A <em>409 Conflict</em> response is sent when <code>true</code>.</p>
<h3 id="_known_methods">known_methods</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -344,7 +344,7 @@ http://www.gnu.org/software/src-highlite -->
<p>The full list of methods known by the server should be returned, regardless of their use in the resource.</p>
<p>The default value lists the methods Cowboy knows and implement in <code>cowboy_rest</code>.</p>
<h3 id="_languages_provided">languages_provided</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -357,7 +357,7 @@ http://www.gnu.org/software/src-highlite -->
<p>During content negotiation Cowboy will pick the most appropriate language for the client. The client advertises languages it prefers with the accept-language header. When that header is missing, Cowboy picks the first language from the resource.</p>
<!-- @todo We should explain precisely how languages are picked.-->
<p>Cowboy will add the negotiated <code>language</code> to the Req object after this step completes:</p>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -366,7 +366,7 @@ http://www.gnu.org/software/src-highlite -->
}</tt></pre>
</div></div>
<h3 id="_last_modified">last_modified</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -378,7 +378,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return the resource&apos;s last modification date.</p>
<p>This date will be used to test against the if-modified-since and if-unmodified-since headers, and sent as the last-modified header in the response to GET and HEAD requests.</p>
<h3 id="_malformed_request">malformed_request</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -390,7 +390,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the request is malformed.</p>
<p>A request is malformed when a component required by the resource is invalid. This may include the query string or individual headers. They should be parsed and validated in this function. The body should not be read at this point.</p>
<h3 id="_moved_permanently">moved_permanently</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -401,7 +401,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return whether the resource was permanently moved, and what its new location is.</p>
<h3 id="_moved_temporarily">moved_temporarily</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -412,7 +412,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return whether the resource was temporarily moved, and what its new location is.</p>
<h3 id="_multiple_choices">multiple_choices</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -426,7 +426,7 @@ http://www.gnu.org/software/src-highlite -->
<p>When returning <code>true</code> the server should send a body with links to the different representations. If the server has a preferred representation it can send its link inside a location header.</p>
<p>Note that when replying manually in this callback you should either call <code>cowboy_req:reply/4</code> or remove the response body that Cowboy sets to avoid surprises.</p>
<h3 id="_options">options</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -435,7 +435,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Respond to an OPTIONS request.</p>
<p>The response should inform the client the communication options available for this resource. By default Cowboy will send a <em>200 OK</em> response with the allow header set.</p>
<h3 id="_previously_existed">previously_existed</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -446,7 +446,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return whether the resource existed previously.</p>
<h3 id="_providecallback">ProvideCallback</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -464,7 +464,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Note that there used to be a way to stream the response body. It was temporarily removed and will be added back in a later release.</p>
<!-- @todo Add a way to switch to loop handler for streaming the body.-->
<h3 id="_rate_limited">rate_limited</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -478,7 +478,7 @@ http://www.gnu.org/software/src-highlite -->
<p>This function can be used to temporarily restrict access to a resource when the user has issued too many requests.</p>
<p>When the resource is rate limited the <code>RetryAfter</code> value will be sent in the retry-after header for the <em>429 Too Many Requests</em> response. It indicates when the resource will become available again and can be specified as a number of seconds in the future or a specific date/time.</p>
<h3 id="_resource_exists">resource_exists</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -489,7 +489,7 @@ http://www.gnu.org/software/src-highlite -->
</div></div>
<p>Return whether the resource exists.</p>
<h3 id="_service_available">service_available</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -501,7 +501,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the service is available.</p>
<p>A <em>503 Service Unavailable</em> response will be sent when this function returns <code>false</code>.</p>
<h3 id="_uri_too_long">uri_too_long</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -513,7 +513,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the requested URI is too long.</p>
<p>This function can be used to further restrict the length of the URI for this specific resource.</p>
<h3 id="_valid_content_headers">valid_content_headers</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -525,7 +525,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the content headers are valid.</p>
<p>This callback can be used to reject requests that have invalid content header values, for example an unsupported content-encoding.</p>
<h3 id="_valid_entity_length">valid_entity_length</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -537,7 +537,7 @@ http://www.gnu.org/software/src-highlite -->
<p>Return whether the request body length is within acceptable boundaries.</p>
<p>A <em>413 Request Entity Too Large</em> response will be sent if this function returns <code>false</code>.</p>
<h3 id="_variances">variances</h3>
-<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
@@ -593,6 +593,8 @@ http://www.gnu.org/software/src-highlite -->
+ <li><a href="/docs/en/cowboy/2.7/manual">2.7</a></li>
+
<li><a href="/docs/en/cowboy/2.6/manual">2.6</a></li>
<li><a href="/docs/en/cowboy/2.5/manual">2.5</a></li>