|
|
|
|
WebserviceWriteHTTPCode (Function) In french: WebserviceEcritCodeHTTP
Not available
Fills the HTTP code that will be returned at the end of execution of REST Webservice function. This function is used to specify some categories of return codes: - 2xx codes for Successful responses.
- 3xx codes for Redirects.
- 4xx codes for Client errors.
- 5xx codes for Server errors.
// Indicates the client creation: 201 Created WebserviceWriteHTTPCode(201, "https://server/Client/" + Client.id) // And returns the client details RETURN sClient // Indicates the absence of response: 204 No Content WebserviceWriteHTTPCode(204) // And returns no response RETURN "" // Accepts a JSON or XML content SWITCH WebserviceReadMIMEType() CASE "application/json" // Processes the JSON case ... CASE "application/xml" // Processes the XML case ... OTHER CASE // Processes the other cases (triggers an error) // Indicates that the format of received data is in unknown: // 415 Unsupported Media Type WebserviceWriteHTTPCode(415, sError) RETURN END Syntax
WebserviceWriteHTTPCode(<HTTP code> [, <Additional information>])
<HTTP code>: Integer HTTP code returned by the call to the Webservice. The following codes are accepted:- Codes 2xx (Successful responses).
- Codes 3xx (Redirects).
- Codes 4xx (Client errors).
- Codes 5xx (Server errors).
For more details, see Details of usable codes. <Additional information>: Optional character string Additional information required by some return codes. The affected return codes are as follows:- Code 201 (Created): optional information: Address of added information.
- Code 301 (Moved Permanently): mandatory information: Redirection address.
- Code 302 (Moved Temporarily): mandatory information: Redirection address.
- Codes 4xx and 5xx: mandatory information: Text of error returned to the client. The text will be converted into UTF-8.
Remarks - This function is useful if the call to the REST Webservice must return a code other than 200.
- The WEBDEV Application Server automatically generates a code 4xx or 5xx for the detected errors.
- This function is only available during the call to a function that processes a request of a REST Webservice. In all other cases, the function triggers an error.
Details of usable codes The following HTTP codes returned by the call to the Webservice are accepted: - Codes 1xx
- 100 Continue
- 101 Switching Protocols
- 102 Processing
- 103 Early Hints
- Codes 2xx (Successful responses)
- 200 OK
- 201 Created
- 202 Accepted
- 203 Non-Authoritative Information
- 204 No Content
- 205 Reset Content
- 206 Partial Content
- 207 Multi-Status
- 208 Already Reported
- 226 IM Used
- Codes 3xx (Redirects)
- 300 Multiple Choices
- 301 Moved Permanently
- 302 Found
- 303 See Other
- 304 Not Modified
- 305 Use Proxy
- 307 Temporary Redirect
- 308 Permanent Redirect
- Codes 4xx (Client errors)
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Time-out
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Request Entity Too Large
- 414 Request-URI Too Long
- 415 Unsupported Media Type
- 416 Requested range unsatisfiable
- 417 Expectation failed
- 421 Bad mapping / Misdirected Request
- 422 Unprocessable entity
- 423 Locked
- 424 Method failure
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- Codes 5xx (Server errors)
- 500 Internal Server Error
- 501 Not Implemented
- 502 Bad Gateway ou Proxy Error
- 503 Service Unavailable
- 504 Gateway Time-out
- 505 HTTP Version not supported
- 506 Variant Also Negotiates
- 507 Insufficient storage
- 508 Loop detected
- 510 Not extended
- 511 Network authentication required
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|