WSPut

Update an existing resource with the WSPut attribute.

Syntax

WSPut

Usage

You use this attribute to specify the action of the HTTP verb PUT to update an existing resource. You set the WSPut attribute in the ATTRIBUTES() clause of the function.

Example WSPut to update a user record

TYPE profileType RECORD ... END RECORD

PUBLIC FUNCTION UpdateUserProfile(
    id STRING ATTRIBUTE(WSParam),
    thisUser profileType )
  ATTRIBUTES (WSPut,
              WSPath="/users/{id}",
              WSDescription="Update user with the given id",
              WSThrows='404:user not found')
  RETURNS STRING
    DEFINE ret STRING
    # ... function code  ...
    LET ret = SFMT("Updated user with ID: %1",id)
    RETURN ret
END FUNCTION
In this example, a resource is updated. thisUser is data passed in the message body in either JSON or XML format. An example of the resource URL shows xxx as the user id replaced in the Genero BDL function.
http://host:port/gas/ws/r/xcf/users/xxx