Module mod_ocs_rest_patch
Handle received HTTP PATCH requests.
Copyright © 2016 - 2026 SigScale Global Inc.
Handle received HTTP PATCH requests.
This is an httpd callback module handling
HTTP PATCH operations. The HTTP resources are managed in modules named
ocs_rest_res_*.
The resource handler modules should implement callback functions
in the pattern described in the example below.
patch_<Resource>(Id, ContentType, RequestBody, [...]) -> Result
- Id = string()
- ContentType = string()
- RequestBody = string()
- Result = {ok, Headers, ResponseBody}
| {error, StatusCode}
| {error, StatusCode, Problem}
- ResponseBody = io_list()
- StatusCode = 400..599
- Problem = #{type := uri(), title := string(),
code := string(), cause => string(), detail => string(),
invalidParams => [#{param := string(), reason => string()}],
status => 400..599}
Resource handlers for HTTP PATCH operations on REST Resources.
Response Headers must include content_type if ResponseBody is
not en empty list. An optional Problem report may be provided in
error responses which shall be formatted by
format_problem/2 and included
in the response body.
do(ModData) -> Result
- ModData = #mod{}
- Result = {proceed, OldData} | {proceed, NewData} | {break, NewData} | done
- OldData = list()
- NewData = [{response, {StatusCode, Body}}] | [{response, {response, Head, Body}}] | [{response, {already_sent, StatusCode, Size}}]
- StatusCode = integer()
- Body = iolist() | nobody | {Fun, Arg}
- Head = [HeaderOption]
- HeaderOption = {Option, Value} | {code, StatusCode}
- Option = accept_ranges | allow | cache_control | content_MD5 | content_encoding | content_language | content_length | content_location | content_range | content_type | date | etag | expires | last_modified | location | pragma | retry_after | server | trailer | transfer_encoding
- Value = string()
- Size = term()
- Fun = fun((Arg) -> sent | close | Body)
- Arg = [term()]
Erlang web server API callback function.
get_etag(Headers) -> any()
Generated by EDoc