Return value attributes
A RESTful web service function can have return values.
The type of return values is defined by the ATTRIBUTES
property. Table 1 lists the return types.
Additional parameters can be specified to provide a name or description; and depending on the
parameter type, other attributes might identify the parameter as optional or specify a supported
data format.
PUBLIC FUNCTION function-name(
#...
parameter-name INTEGER ATTRIBUTES(WSParam),
# ...
)
ATTRIBUTES(
# function attributes ...
)
RETURNS ( INTEGER ATTRIBUTES(WSHeader),
STRING ATTRIBUTES (WSDescription = "Greeting")
)
# function code
RETURN 3, "Hello world"
END FUNCTION
Return type | Description | Other attributes allowed |
---|---|---|
WSHeader | The return value contains a custom header. | |
WSAttachment | The return value contains a path to a file for attachment. | |
Response body (without WSHeader ) |
Denotes the return value is used for transferring data in the response body. Data can be
JSON, XML, text, or a file type (like an image). Data of different MIME types can be sent in multiple parts of the same response. See Multipart requests or responses |
|