category
rest
REST authoring layer built on top of the HTTP router category.
logtalk_load(rest(loader))staticPublic predicates
path_parameter/3
Returns a named path parameter extracted by the router from the current request using deterministic lookup.
staticpath_parameter(Request,Name,Value)path_parameter(+compound,?atom,?term) - zero_or_onequery_parameter/3
Returns the first named query parameter from the current request when query pairs are available.
staticquery_parameter(Request,Name,Value)query_parameter(+compound,?atom,?term) - zero_or_onerequest_header/3
Returns a normalized request header value.
staticrequest_header(Request,Name,Value)request_header(+compound,?atom,?term) - zero_or_morerequest_body/2
Returns the normalized request body term.
staticrequest_body(Request,Body)request_body(+compound,-compound) - zero_or_onejson_body/2
Returns the decoded JSON payload from a normalized request body and reports a client error when the request body is missing or not decoded as JSON.
staticjson_body(Request,JSON)json_body(+compound,-term) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected JSON request body.)json_object_body/2
Returns the decoded JSON payload when it is a JSON object term and reports a client error when the request body is missing, not decoded as JSON, or not an object.
staticjson_object_body(Request,JSONObject)json_object_body(+compound,-term) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected JSON request body.)problem(400,urn:logtalk:invalid-request-body,Bad Request,Expected JSON object request body.)json_array_body/2
Returns the decoded JSON payload when it is a JSON array term and reports a client error when the request body is missing, not decoded as JSON, or not an array.
staticjson_array_body(Request,JSONArray)json_array_body(+compound,-list) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected JSON request body.)problem(400,urn:logtalk:invalid-request-body,Bad Request,Expected JSON array request body.)form_body/2
Returns the decoded form payload from a normalized request body and reports a client error when the request body is missing or not decoded as form data.
staticform_body(Request,Pairs)form_body(+compound,-list(compound)) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected form request body.)text_body/2
Returns the decoded text payload from a normalized request body and reports a client error when the request body is missing or not decoded as text.
statictext_body(Request,Text)text_body(+compound,-atom) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected text request body.)binary_body/2
Returns the decoded binary payload from a normalized request body and reports a client error when the request body is missing or not decoded as binary.
staticbinary_body(Request,Bytes)binary_body(+compound,-list(integer)) - one_or_errorproblem(400,urn:logtalk:invalid-request-body,Bad Request,Expected binary request body.)json_response/4
Builds a JSON response for the given request and status descriptor, honoring any negotiated response media type annotation.
staticjson_response(Request,Status,JSON,Response)json_response(+compound,++term,++term,-compound) - one_or_errorStatus is a variable or a status(Code, Reason) term with a variable argument:instantiation_errorStatus is an integer without a built-in reason phrase supported by the rest library:domain_error(http_status_code,Status)Status is neither an integer nor a valid normalized HTTP status term:domain_error(http_status,Status)json_response/5
Builds a JSON response for the given request and status descriptor, honoring any negotiated response media type annotation and adding the provided normalized headers.
staticjson_response(Request,Status,Headers,JSON,Response)json_response(+compound,++term,+list(compound),++term,-compound) - one_or_errorStatus is a variable or a status(Code, Reason) term with a variable argument:instantiation_errorStatus is an integer without a built-in reason phrase supported by the rest library:domain_error(http_status_code,Status)Status is neither an integer nor a valid normalized HTTP status term:domain_error(http_status,Status)Headers is not a valid normalized header list:domain_error(http_headers,Headers)created_response/4
Builds a 201 Created JSON response with a Location header, honoring any negotiated response media type annotation.
staticcreated_response(Request,Location,JSON,Response)created_response(+compound,++term,++term,-compound) - one_or_errorLocation is not a valid normalized header value:domain_error(http_header_value,Location)no_content_response/2
Builds a 204 No Content response.
staticno_content_response(Request,Response)no_content_response(+compound,-compound) - one_or_errorRequest is not a valid normalized HTTP request term:domain_error(http_request,Request)problem_response/6
Builds an application/problem+json response with the standard type, title, detail, and numeric status fields.
staticproblem_response(Request,Status,Type,Title,Detail,Response)problem_response(+compound,++term,++atom,++atom,++atom,-compound) - one_or_errorStatus is a variable or a status(Code, Reason) term with a variable argument:instantiation_errorStatus is an integer without a built-in reason phrase supported by the rest library:domain_error(http_status_code,Status)Status is neither an integer nor a valid normalized HTTP status term:domain_error(http_status,Status)Protected predicates
endpoint/5
Hook predicate that enumerates REST endpoint descriptors. Id is the endpoint identifier and must be unique within the importing object; when OpenAPI derivation is used it also becomes the operation identifier. Method is the lowercase HTTP method, Path the path template, Action the name of a declared local predicate with arity 2, and Options a list of route metadata terms plus the optional produces(MediaTypes) descriptor.
staticendpoint(Id,Method,Path,Action,Options)endpoint(?atom,?atom,?atom,?atom,?list(compound)) - zero_or_moreopen_api_validate_request/1
Optional hook predicate that enables automatic OpenAPI request contract validation for the given endpoint identifier before its action predicate is called.
staticopen_api_validate_request(Id)open_api_validate_request(?atom) - zero_or_moreopen_api_request_validation_error_response/4
Optional hook predicate that customizes the response returned when OpenAPI request contract validation fails. The default implementation preserves the distinction between generic 400 request failures, 415 Unsupported Media Type, and 422 Unprocessable Content for invalid request bodies. The arguments are the current request, the endpoint identifier, the validation errors, and the response to send.
staticopen_api_request_validation_error_response(Request,Id,Errors,Response)open_api_request_validation_error_response(+compound,+atom,+list,-compound) - zero_or_oneopen_api_validate_response/1
Optional hook predicate that enables automatic OpenAPI response contract validation for the given endpoint identifier after its action result is normalized into an HTTP response.
staticopen_api_validate_response(Id)open_api_validate_response(?atom) - zero_or_moreopen_api_response_validation_error_response/5
Optional hook predicate that customizes the response returned when OpenAPI response contract validation fails. The arguments are the current request, the endpoint identifier, the candidate response, the validation errors, and the response to send.
staticopen_api_response_validation_error_response(Request,Id,Response0,Errors,Response)open_api_response_validation_error_response(+compound,+atom,+compound,+list,-compound) - zero_or_onerest_action_failure_response/3
Optional hook predicate that customizes the response returned when the matched endpoint action fails without throwing an exception. The arguments are the current request, the endpoint identifier, and the response to send.
staticrest_action_failure_response(Request,Id,Response)rest_action_failure_response(+compound,+atom,-compound) - zero_or_onerest_action_error_response/4
Optional hook predicate that customizes the response returned when the matched endpoint action throws an unsupported exception. The arguments are the current request, the endpoint identifier, the thrown term, and the response to send.
staticrest_action_error_response(Request,Id,Error,Response)rest_action_error_response(+compound,+atom,+term,-compound) - zero_or_onedispatch_rest_endpoint/2
Runs the action associated with the matched endpoint and normalizes any supported returned or thrown result term into an HTTP response.
staticdispatch_rest_endpoint(Request,Response)dispatch_rest_endpoint(+compound,-compound) - one_or_errorexistence_error(rest_endpoint_id,Id)domain_error(rest_endpoint_id,duplicate(Id))domain_error(rest_result,Result)Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)