WSGet

In order to retrieve a resource, you set the WSGet attribute.

Syntax

WSGet

Usage

You use this attribute to specify the action of the HTTP verb GET to return data from a resource. You set the WSGet attribute in the ATTRIBUTES() clause of the function.

Example using WSGet to return a user record

TYPE profileType RECORD ... END RECORD

PUBLIC FUNCTION GetUserProfile(
      id STRING ATTRIBUTE(WSParam) )
  ATTRIBUTES (WSGet,
              WSPath="/users/{id}",
              WSDescription="Returns a user profile",
              WSThrows="404:user not found" )
  RETURNS (profileType ATTRIBUTE(WSName="User_data", WSMedia="application/json") )
    DEFINE data profileType
    # ... function code  ...
    RETURN data.*
END FUNCTION
In this example the REST function gets the specified user record. The resource URL is:
http://host:port/gas/ws/r/xcf/users/xxx
xxx is the user id replaced in the Genero BDL function.