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://myhost:6394/gas/ws/r/myGroup/myXcf/users/2

Where 2 in the URI is the user id replaced in the Genero BDL function.