WSRetCode
Defines the HTTP status sent in the REST response.
Syntax
WSRetCode= "{ code | code:description } "
Where
WSRetCode
is a string enclosed in quotations and where:- code is an HTTP code representing successful status in the range 200 to 399.
- description provides a description.
Important: If you use the code option without a description, the
default fault description defined in RFC 2616 is returned to the client. If you use the code
option with a description, there is no space before or after the colon (
:
).
Usage
You use WSRetCode
in the ATTRIBUTES()
clause of the REST
function to specify the HTTP protocol status in the response. The HTTP code and HTTP description you
provide is sent in the HTTP protocol response.
Example using WSRetCode in REST function
PUBLIC FUNCTION Add(
a INTEGER ATTRIBUTE(WSQuery),
b INTEGER ATTRIBUTE(WSQuery) )
ATTRIBUTES(WSGet,
WSRetCode="215:correct" )
RETURNS INTEGER
RETURN a + b
END FUNCTION
In this trivial example, instead of "200 OK", the HTTP response is changed to "215 correct".