Start of change

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

You must have one of the following privileges or authorities to discover all Db2 REST services:
  • Execute privilege on the package for the service
  • Ownership of the service
  • SYSADM or SYSCTRL authority
  • System DBADM.

Procedure

  • To discover all services, enter a URI to start either an HTTPS POST or GET request:
    • GET https://<host>:<port>/services/
    • POST https://<host>:<port>/services/DB2ServiceDiscover
  • Set the HTTP header Accept and Content-Type fields to application/json for the request.
Start of change

Example

To discover all services, 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 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"
        }
    ],
}   
End of change
End of change