Preparing a sample Db2 native REST service
Enable and create Db2 native REST services that use
the Db2 sample tables. These services are then used by the
sample OpenAPI definition,
EmployeesApi.yaml
, that's part of the sample-db2-api download.
Before you begin
About this task
This topic is applicable to:
getEmployees
- Returns a list of employees.getEmployee
- Returns the details of an individual employee.
addEmployee
- Add the details of an individual employee.updateEmployee
- Update the details of an individual employee.deleteEmployee
- Removes the details of an individual employee.
These services are created by using the Db2 Service
Manager native REST service. Alternatively, the BIND SERVICE subcommand can be used to create a new
Db2 native REST service. For each request, replace
<db2_host_name>
with the hostname of your Db2 instance and <db2_port>
with the port of your Db2 instance. You might also need to include authentication credentials such as
the Authorization HTTP header.
The services that are created in this sample scenario use the default Db2 collection SYSIBMSERVICE
.
Procedure
Results
getEmployee
, and getEmployees
are Db2 native REST services, created as part of the
SYSIBMSERVICE
collection in Db2.