Discovering all Db2 REST services
You can use the Db2 REST service discover API to discover all available services if you have the required authority.
Before you begin
- Execute privilege on the package for the service
- Ownership of the service
- SYSADM or SYSCTRL authority
- System DBADM.
Procedure
Example
This example shows how to discover all services and includes setting the Db2-Client-ApplName and Db2-Client-WrkStnName HTTP request header fields to the values "Customer Service" and "CS Laptop-47", respectively. Enter the following URI to start an HTTPS POST request:
POST https://<host>:<port>/services/DB2ServiceDiscover
Specify the following HTTP header fields for the request:
Accept:application/json
Content-Type:application/json
Db2-Client-ApplName:Customer Service
Db2-Client-WrkStnName:CS Laptop-47
Db2 returns a response in JSON like the following:
{
"DB2Services": [
{
"serviceName": "DB2ServiceDiscover",
"serviceCollectionID": null,
"version": null,
"isDefaultVersion": true,
"serviceStatus": "started",
"serviceDescription": "DB2 service to list all available services.",
"serviceProvider": "db2service-1.0",
"serviceURL": "<host>:<port>/services/DB2ServiceDiscover"
},
{
"serviceName": "DB2ServiceManager",
"serviceCollectionID": null,
"version": null,
"isDefaultVersion": true,
"serviceStatus": "started",
"serviceDescription": "DB2 service to create, drop, or alter a user defined service.",
"serviceProvider": "db2service-1.0",
"serviceURL": "<host>:<port>/services/DB2ServiceManager"
},
{
"serviceName": "callSPBigOuts",
"serviceCollectionID": "SYSIBMSERVICE",
"version": "",
"isDefaultVersion": true,
"serviceStatus": "started",
"serviceDescription": "Call SP SYSADM.BigOuts. Multiple Varchar(32704) OUTPUT PARMS.",
"serviceProvider": "db2service-1.0",
"serviceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPBigOuts",
"alternateServiceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPBigOuts"
},
{
"serviceName": "callSPDeptUpdate",
"serviceCollectionID": "SYSIBMSERVICE",
"version": "V1",
"isDefaultVersion": true,
"serviceStatus": "started",
"serviceDescription": "Call SP SYSADM.DeptUpdateSP, which takes single input NewLocation parm.",
"serviceProvider": "db2service-1.0",
"serviceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPDeptUpdate/V1",
"alternateServiceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPDeptUpdate"
},
{
"serviceName": "callSPRestT20",
"serviceCollectionID": "SYSIBMSERVICE",
"version": "",
"isDefaultVersion": true,
"serviceStatus": "started",
"serviceDescription": "Call SP SYSADM.RestT20. Uses LITERALS for the input and vchar, OUT int and vchar.",
"serviceProvider": "db2service-1.0",
"serviceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPRestT20",
"alternateServiceURL": "<host>:<port>/services/SYSIBMSERVICE/callSPRestT20"
}
],
}