Using RESTful attributes in functions

RESTful attributes define functions for your RESTful web service.

You declare certain things about functions in your Web service program which identifies the function as a high level RESTful web service and helps the compiler check your code accordingly.

The keyword ATTRIBUTE or ATTRIBUTES allows you to specify special RESTful attributes (identified with WS* prefix) when declaring a function. This keyword is followed by an attribute specification inside parentheses.

If you have a function you want to publish as a RESTful function of a Web service, you implement the function in the following way:
Function attributes
You must specify the HTTP operation, such as GET, POST, PUT, or DELETE, you want to perform on the resource in the function's attribute property. You must also specify the path to the Web service resource using the WSPath RESTful attribute here. This is a minimum requirement for a RESTful function. See the prototype function example in HTTP verbs and attributes.
Input parameters
If the resource needs data to be passed in as queries, cookies, or headers in order to perform the operation, you must declare input parameters and specify the required attribute in the attributes property. Or if data must be sent in the body of the request, you specify an input parameter to receive the data. This parameter does not require any special RESTful attribute. See the prototype function example in Input parameter attributes.
Return values
You handle returns in the function as you would in a normal function, except when you want to send data in the header response. Then you must specify this in the returns value attribute property. If the data must go in the body of the response, you specify a return value to receive the data. This return value does not require any special RESTful attribute. See the prototype function example in Return value attributes.