WSRetCode

Defines the HTTP success status sent in the REST response.

Syntax

WSRetCode= "{ code | code:description } "
Where WSRetCode is a string enclosed in quotations and where:
  1. code is an HTTP code representing successful status in the range 200 to 399.
  2. description provides a description.

If you use the code option without a description, the default 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 (:).

WSRetCode is an optional attribute.

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

In this trivial example, instead of "200 OK", the HTTP response is changed to "215 correct".
PUBLIC FUNCTION Add(
    a INTEGER ATTRIBUTES(WSQuery),
    b INTEGER ATTRIBUTES(WSQuery) )
  ATTRIBUTES(WSGet,
             WSRetCode="215:correct" )
  RETURNS INTEGER
    RETURN a + b
END FUNCTION
Figure: HTTP response using WSRetCode