db2ibm-clouddashdbwarehouse

V2/V3 of Db2 Warehouse Rest API


I am currently trying to use the Rest API with a standalone docker image of Db2 Warehouse developer edition.

I have downloaded the docker image from the IBM docker hub "https://hub.docker.com/_/ibm-db2-warehouse-dev?tab=resources"

After having installed the image, I have been able to use successfuly the V1 of the rest API, by loading data from a file with raw data towards a Db2 table.

But now I am trying to use the V2 or V3 of the rest API, but unfortunately, it does not work. I work on Linux OpenSuse 15.0. The curl version I use is 7.60.0 (x86_64-suse-linux-gnu).

Test with V3 rest API

curl -X POST "https://192.168.66.56:8443/dbapi/v3/auth/tokens" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"userid\": \"foo\",  \"password\": \"bar\"}"

This command returns nothing.

I have tried to add the user parameter to the curl command line:

curl -X POST "https://192.168.66.56:8443/dbapi/v3/auth/tokens" -H  "accept: application/json" -H  "Content-Type: application/json" -d "{  \"userid\": \"foo\",  \"password\": \"bar\"}" --user "foo:bar"

then curl returns:

{
     "trace": "",
     "errors": [
    {
        "code":"not_found",
        "message": "The requested resource is not found",
        "target": {
            "type": "",
            "name": ""
        },
        "more_info": ""
    }
    ]
}[

I have exactly the same behavior with the V2 rest API. I have tried to play with single and double quotes, it changes nothing.

I am wondering if the V2/V3 of the rest API is implemented/installed on the Db2 Warehouse docker image, according to the response I get from curl The requested resource is not found.

Any clue will be appreciated !

Thanks !


Solution

  • Only version 1 of the REST API is documented to work on Db2 Warehouse. The Knowledge Center article on the REST API for Db2 Warehouse, which you can find at https://www.ibm.com/support/knowledgecenter/SSCJDQ/com.ibm.swg.im.dashdb.doc/connecting/connect_api.html, only contains links to https://developer.ibm.com/static/site-id/85/api/db2wh/#analytics and https://developer.ibm.com/static/site-id/85/api/db2wh/#database. Both of them only list version 1 endpoints.

    That is different from Db2 Warehouse on Cloud. The Knowledge Center for that product (https://www.ibm.com/support/knowledgecenter/en/SS6NHC/com.ibm.swg.im.dashdb.doc/connecting/connect_api.html) does indeed contain a link to the version 3 API (https://cloud.ibm.com/apidocs/db2-warehouse-on-cloud).