Example: a REST Service for manipulating data (UPDATE)

Previous Next

In this example, you change the details of a customer that already exists in the database. You can use the PUT or PATCH HTTP verbs. This help topic discusses both. For details, go to Defining REST methods).

This example shows how you can quickly generate a REST service from a SQL statement.

In this particular example, an input parameter is used that is part of the request URL path, but you have a number of other options when designing input parameters.

Example

PersonTable          

 

 

 

PersonStructure

Database Table

Service Definer Structure

This will be the resource we use. Notice that our resource doesn't contain the Email and the Birth_Date fields that are defined in the database table. This is data we do not want to update in the example and thus we do not make this part of our resource.

collapseDefining SQL in the normal application
collapseDefining SQL in Service Definer (using PATCH)
collapseDefining SQL in Service Definer(using PUT)
collapseGenerating a REST method based on SQL
collapseOrganising input for the ID parameter
collapsePublishing the solution
collapseTesting the implementation

 

 

Another popular design of this type of REST call is to pass back the result data in a response message. For this design, go to help topic " Example: a REST Service for returning manipulated data ".

 

See also

Generating a REST service from SQL

Example: a REST service for retrieving data (SELECT)

Example: a REST Service for adding new data (INSERT)

Example: a REST Service for returning manipulated data

Example: a REST Service for deleting data (DELETE)