WSPost

In order to create a new resource, you set the WSPost attribute.

Syntax

WSPost

Usage

You use this attribute to specify the action of the HTTP verb POST to create a new resource. You set the WSPost attribute in the ATTRIBUTES() clause of your function.

Example WSPost to create a new user record

TYPE profileType RECORD
     id INT,
     name VARCHAR(50),
     email VARCHAR(100)
   END RECORD

PUBLIC FUNCTION CreateUserProfile( newUser profileType ) 
  ATTRIBUTES (WSPost,
              WSPath="/users",
              WSThrows="404:user not found")
  RETURNS STRING 
    DEFINE ret STRING
    # ... function code  ...
    LET ret = SFMT("Created user with ID: %1",id)
    RETURN ret
END FUNCTION
In this example a new resource is created. newUser is data passed in the message body in either JSON or XML format. An example of the resource URL is:
http://host:port/gas/ws/r/xcf/users