Start of change

Dropping a Db2 REST service

You can use the Db2 REST service manager API to drop a user-defined service if you have the required authority. Dropping a service removes the service, frees its associated package, and deletes the corresponding row from the SYSIBM.DSNSERVICE catalog table. You can also issue the FREE SERVICE command to drop a REST service.

Before you begin

When you drop a service, you must have a privilege that allows the runner to free or drop the associated package. See FREE SERVICE (DSN) for required authorization.

Procedure

  • To drop a service, issue an HTTP or HTTPS POST request through a REST client with the following URI:
    POST https://<host>:<port>/services/DB2ServiceManager
  • Set the HTTP header Accept and Content-Type fields to application/json for the request.
  • Specify the following HTTP body for the request:
    {
     "requestType": "dropService",
     "collectionID": "<serviceCollectionID>",
     "serviceName": "<serviceName>",
     "version": "<version-id>"
    }
    

    where

    • dropService indicates that you request to remove a user-defined service.
    • <serviceCollectionID> is the identifier of the package that is associated with the service.
    • <serviceName> is the name of the service that you want to drop.
    • <version-id> is the version of the service you want to drop. If you omit the <version-id>, the default version of the REST service is deleted.

Example

To drop the V1 version of service simpleSelect1, enter the following URI to start an HTTPS POST request:

POST https://<host>:<port>/services/DB2ServiceManager

Specify the following HTTP header fields for the request:

Accept:application/json
Content-Type:application/json

Specify the following HTTP body for the request:

{
 "requestType": "dropService",
 "collectionID": "SYSIBMSERVICE",
 "serviceName": "simpleSelect1",
 "version": "V1"
}

Db2 returns the following response in JSON:

{
 "StatusCode":200,
 "StatusDescription": "DB2 Rest Service SYSIBMSERVICE.simpleSelect1.(V1) was dropped successfully."
}

The response shows that service simpleSelect1 was successfully removed.

End of change