WSPatch

In order to partially update an existing resource, you define the WSPatch attribute.

Syntax

WSPatch

Usage

You use this attribute to specify the action of the HTTP verb PATCH to partially update an existing resource. For instance, when you need to update the full resource, you use WSPut. When you just want to update a single field in a resource, you use WSPatch. You set the WSPatch attribute in the ATTRIBUTES() clause of the function.

Example using WSPatch to push partial resource change

PUBLIC FUNCTION UpdateUserProfile(
   id STRING ATTRIBUTE(WSParam), email STRING)
   ATTRIBUTES(WSPatch,
              WSPath = "/users/{id}",
              WSDescription = "Update user with the given id",
              WSThrows = '400:@UserError,404:no user found')

   #... function code ...

 END FUNCTION 

In this example the REST function updates a field in the user resource.