Endpoint URLs
The service endpoint is based on your IBM Cloud Pak deployment URL.
https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/{method}
For example, if your instance is deployed at https://www.example.com:31843
, you can access the APIs
at https://www.example.com:31843/cognosanalytics/{tethered_namespace}/artifacts/v1/{method}
.
Example request to endpoint
curl -H "Authorization: Bearer {token}" -X {request_method} "https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/{method}"
Replace {token}
, {request_method}
, {tethered_namespace}
and {method}
in this example with the
values for you particular API call.
Authentication
To authenticate to the API, pass a bearer access token or platform API key token in an Authorization
header.
If Identity and Access Management (IAM) are not enabled, you can generate a token by using your username and password against the Get authorization token endpoint.
If IAM is enabled, you can generate a token by using your username and password against the /idprovider/v1/auth/identitytoken
endpoint.
With a platform API key, you can access everything that you would typically be able to access when you log in to the Cloud Pak for Data web client.
To generate a platform API key through the user experience:
- Log in to the web client.
- From the toolbar, click your avatar.
- Click Profile and settings.
- Click API key > Generate new key.
- Click Generate.
- Click Copy and save your key somewhere safe. You cannot recover this key if you lose it.
Alternatively, you can call the Generate API key method. Note: this method must be called with bearer access token authorization.
When you get the API Key from the user experience or from the generate API Key method, you must base64 encode <username>:<api_key>
to get the token.
Generating an access token by using the Get authorization token endpoint. The response includes a token
property.
Replace {cpd_cluster_host}
with the details for the service instance. Replace {username}
and {password}
with your IBM Cloud Pak for Data credentials.
curl -k -X POST "https://{cpd_cluster_host}/icp4d-api/v1/authorize" -d "{\"username\":\"{username}\",\"password\":\"{password}\"}" -H "Content-Type: application/json"
Alternatively, you can use an API key instead of a password. Replace {username}
and {api_key}
with your IBM Cloud Pak for Data credentials.
curl -k -X POST "https://{cpd_cluster_host}/icp4d-api/v1/authorize" -d "{\"username\":\"{username}\",\"api_key\":\"{api_key}\"}" -H "Content-Type: application/json"
Authenticating to the API by using an access token. Replace {token}
with your details.
curl "https://{cpd_cluster_host}/v1/{method}" -H "Authorization: Bearer {token}" -H "Content-Type: application/json"
Authenticating to the API by using a base64 encoded API key token. Replace {token}
with your details.
Generate the token by using an API key and its respective username.
echo "<username>:<api_key>" | base64
curl "https://{cpd_cluster_host}/v1/{method}" -H "Authorization: ZenApiKey {token}" -H "Content-Type: application/json"
Error handling
Required Purpose: Defines common response codes and the language-specific response models. For more information, see API Handbook - Errors. Example:
This API uses standard HTTP response codes to indicate whether a method completed successfully. A 200
response indicates success. A 400
type response indicates a failure, and a 500
type response indicates an internal system error.
HTTP Error Code | Description | Recovery |
---|---|---|
200 |
Success | The request was successful. |
400 |
Bad Request | The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request. |
401 |
Unauthorized | You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact the account owner to check your permissions. |
403 |
Forbidden | The supplied authentication is not authorized to access '{namespace}'. |
404 |
Not Found | The requested resource could not be found. |
408 |
Request Timeout | The connection to the server timed out. Wait a few minutes, then try again. |
409 |
Conflict | The entity is already in the requested state. |
500 |
Internal Server Error | offering_name is currently unavailable. Your request could not be processed. Wait a few minutes and try again. |
ErrorResponse
Name | Type | Description |
---|---|---|
status |
Integer | HTTP error code. |
error |
String | Human-readable error string, like 'Invalid image file'. |
When the Node SDK receives an error response from the Visual Recognition service, it creates an Error object with information describing the error that occurred. This error object is passed as the first parameter to the callback function for the method. The contents of the error object are as shown in the following table:
Errors
Error Field | Description |
---|---|
status | The HTTP status code returned |
error | A message describing the error |
artifacts.method(params,
function(err, response) {
// The error will be the first argument of the callback
if (err.status == 404) {
// Handle Not Found (404) error
} else if (err.status == 413) {
// Handle Request Too Large (413) error
} else {
console.log('Unexpected error: ', err.code);
console.log('error:', err);
}
});
Methods
Request
No Request Parameters
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/drivers' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'
Response
Represents a JDBC driver.
Example:
d290f1ee6c544b0190e6d701748f0851
- driverFileNames
Name of a driver file
Example:
db2jcc.jar
Identifier of the driver file.
Example:
d290f1ee6c544b0190e6d701748f0852
Example:
4.21.29
Example:
db2
The date and time of the upload in epoch format.
Example:
86400
Status Code
A list of driver items.
JWTToken is missing or invalid.
[ { "id": "d290f1ee6c544b0190e6d701748f0851", "driverFileNames": [ { "filename": "db2jcc.jar", "fileid": "d290f1ee6c544b0190e6d701748f0852" } ], "driverVersion": "4.21.29", "targetDatabase": "db2", "createdAt": 86400 } ]
Upload a driver
Adds a JDBC driver. If the driver consists of multiple files, upload all required files in a single request.
POST /drivers
Request
Form Parameters
The driver files to upload. Multiple files can be uploaded.
Driver version.
Default:
1.0
Text description for the database intended to use this driver.
Default:
curl -k -X POST 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/drivers' -H 'Accept: application/json' -H 'Authorization: Bearer {token}' -F "files=@./drivers/in/db2jcc.jar"
Response
Represents a JDBC driver.
Example:
d290f1ee6c544b0190e6d701748f0851
- driverFileNames
Name of a driver file
Example:
db2jcc.jar
Identifier of the driver file.
Example:
d290f1ee6c544b0190e6d701748f0852
Example:
4.21.29
Example:
db2
The date and time of the upload in epoch format.
Example:
86400
Status Code
Driver file uploaded successfully.
An error occurred, see response for details.
JWTToken is missing or invalid.
This object already exists.
[ { "id": "d290f1ee6c544b0190e6d701748f0851", "driverFileNames": [ { "filename": "db2jcc.jar", "fileid": "d290f1ee6c544b0190e6d701748f0852" } ], "driverVersion": "4.21.29", "targetDatabase": "db2", "createdAt": 86400 } ]
Request
Path Parameters
Identifier of the driver.
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/drivers/d290f1ee6c544b0190e6d701748f0851' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'
Response
Represents a JDBC driver.
Example:
d290f1ee6c544b0190e6d701748f0851
- driverFileNames
Name of a driver file
Example:
db2jcc.jar
Identifier of the driver file.
Example:
d290f1ee6c544b0190e6d701748f0852
Example:
4.21.29
Example:
db2
The date and time of the upload in epoch format.
Example:
86400
Status Code
Driver information returned successfully.
JWTToken is missing or invalid.
The object cannot be found.
[ { "id": "d290f1ee6c544b0190e6d701748f0851", "driverFileNames": [ { "filename": "db2jcc.jar", "fileid": "d290f1ee6c544b0190e6d701748f0852" } ], "driverVersion": "4.21.29", "targetDatabase": "db2", "createdAt": 86400 } ]
Delete a driver
Deletes a driver. Any additional files that were uploaded will be also deleted.
DELETE /drivers/{id}
Request
Custom Headers
Allowable values: [
application/zip
,application/jar
]
Path Parameters
Identifier of the driver.
Identifier of the driver file.
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/drivers/d290f1ee6c544b0190e6d701748f0851/filenames/abc0f1ee6c544b0190e6d701748f0852' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'
Request
No Request Parameters
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/deployments' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'
Response
Represents a deployment file.
Identifier of the deployment file.
Example:
d290f1ee6c544b0190e6d701748f0851
Name of the deployment file.
Example:
sample_deployment.zip
The date and time of the upload in epoch format.
Example:
86400
Status Code
List of deployment files.
JWTToken is missing or invalid.
No Sample Response
Request
Form Parameters
curl -k -X POST 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/deployments' -H 'Accept: application/json' -H 'Authorization: Bearer {token}' -F "fileName=@{deployment.zip}"
Response
Represents a deployment file.
Identifier of the deployment file.
Example:
d290f1ee6c544b0190e6d701748f0851
Name of the deployment file.
Example:
sample_deployment.zip
The date and time of the upload in epoch format.
Example:
86400
Status Code
Deployment file uploaded successfully.
An error occurred, see response for details.
JWTToken is missing or invalid.
This object already exists.
No Sample Response
Request
No Request Parameters
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/images' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'
Response
Represents an image.
Identifier of the image.
Example:
abcd0f1ee6c544b0190e6d701748f0851
The file path and name of the image in the images directory.
Example:
sample_image.jpg
The date and time of the upload in epoch format.
Example:
86400
Status Code
List of image metadata.
JWTToken is missing or invalid.
No Sample Response
Request
Form Parameters
The image files to upload. Multiple images can be uploaded.
The directory to save images in under 'webcontent/bi/customImages'. By default, the directory will be '/opt/ibm/cognos/analytics'.
Default:
/opt/ibm/cognos/analytics/webcontent/bi/
The action to take for a duplicate file name. The default value is skip.
Allowable values: [
skip
,overwrite
,fail
]Default:
skip
curl -k -X POST 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/images' -H 'Accept: application/json' -H 'Authorization: Bearer {token}' -F "files=@./images/sample_gif.gif" -F "dirpath=gifdir"
Response
Represents an image.
Identifier of the image.
Example:
abcd0f1ee6c544b0190e6d701748f0851
The file path and name of the image in the images directory.
Example:
sample_image.jpg
The date and time of the upload in epoch format.
Example:
86400
Status Code
Images uploaded successfully.
JWTToken is missing or invalid.
Use a valid image with .jpg, .jpeg, .png, .gif, or .svg extension.
This object already exists.
No Sample Response
Request
Custom Headers
Allowable values: [
image/png
,image/jpg
,image/gif
,image/svg
]
Path Parameters
Identifier of the image to download.
curl -k -X GET 'https://{cpd_cluster_host}/cognosanalytics/{tethered_namespace}/artifacts/v1/images/d290f1ee6c544b0190e6d701748f0851' -H 'Accept: application/json' -H 'Authorization: Bearer {token}'