APIs for your services
Many services in Cloud Pak for Data as a Service provide APIs.
Watson APIs
You can use a collection of REST APIs associated with Watson Studio and Watson Knowledge Catalog and other services to manage data-related assets and the people who need to use these assets. See Watson API docs.
- Refine data
- Use the sampling APIs to create representative subsets of the data on which to test and refine your data cleansing and shaping operations. To better understand the contents of your data, you can create profiles of your data assets that include a classification of the data and additional distribution information which assists in determining the data quality.
- Catalog data
- Use the catalog APIs to create catalogs to administer your assets, associate properties with those assets, and organize the users who use the assets. Assets can be notebooks or connections to files, database sources, or data assets from a connection.
- Policies
- Use the policy APIs to implement policies and a business glossary that fits to your organization to control user access rights to assets and to make it easier to find data.
- Streaming data
- Use the streams flow APIs to hook up continuous, unidirectional flows of massive volumes of moving data that you can analyze in real time.
DataStage APIs
With DataStage you can use a rich set of public REST APIs:
- DataStage Flow APIs, such as Creation, Edit, and Delete
- Job APIs, such as Creation, Edit, Delete, and Run
- Migration APIs
- DataStage Flow Compile APIs
Creating an API Key
To use the DataStage APIs, you must first create an API key.
Go to IBM Cloud IAM to create an API key. Then, save the key in a secure password vault, because you won’t be able to see it again. You need this key to obtain a bearer token.
Obtaining a bearer token
You can use this simple shell function (for Mac) that can help you obtain a bearer token given an API key as an argument.
function ypqa_bearer {
api_key="$1"
curl -X POST \
https://iam.bluemix.net/identity/token \
-H 'Accept: application/json;charset=utf-8' \
-H 'Authorization: Basic Yng6Yng=' \
-H 'Content-Type: application/x-www-form-urlencoded;charset=utf-8' \
-H 'Postman-Token: c0bc1929-c485-40db-8446-1729ea552d4f' \
-H 'cache-control: no-cache' \
--data "grant_type=urn:ibm:params:oauth:grant-type:apikey&response_type=cloud_iam&apikey=$api_key" \
| grep -o "\"access_token\":\".*\"refresh_token\"" > bearer.tmp
#-d 'grant_type=urn:ibm:params:oauth:grant-type:apikey&response_type=cloud_iam&apikey=\"$api_key\"' | grep -o "\"access_token\":\".*\"refresh_token\"" > bearer.tmp
sed 's/\"access_token\":\"//g' bearer.tmp > bearer.tmp2
sed 's/\",\"refresh_token\"//g' bearer.tmp2 > bearer.tmp
#clear
pbcopy < ./bearer.tmp
echo Bearer access token copied to clipboard
cat ./bearer.tmp
rm bearer.tmp
rm bearer.tmp2
}