Example: Delete a resource with WSDelete

Delete a resource with the WSDelete attribute.

Example deleting a resource with WSDelete

In this sample REST function a user resource is deleted.

PUBLIC FUNCTION deleteUsers( id INTEGER ATTRIBUTES(WSParam) )
  ATTRIBUTES(WSDelete,
             WSPath="/users/{id}",
             WSDescription='Delete a user profile')
  RETURNS STRING
    DEFINE ret STRING
    DELETE FROM users WHERE @id = id
    LET ret = SFMT("Deleted user with ID: %1",id)
    RETURN ret
END FUNCTION