API key management APIs

APIs to manage keys.

Base path: https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/

The <Cluster Master Host> and <Cluster Master API Port> parameters are defined in Master endpoints.

Create an API key

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/
Command
POST
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -d '{"name": "test_serviceid_apikey","description": "Description for test_serviceid_apikey ","boundTo": "crn:v1:icp:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f"}' "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/"

The response resembles the following code:

{"metadata":{"uuid":"ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88","createdAt":"2018-05-08T08:13+0000","modifiedAt":"2018-05-08T08:13+0000"},"entity":{"boundTo":"crn:v1:icp:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f","name":"test_serviceid_apikey","description":"Description for test_serviceid_apikey","format":"APIKEY","apiKey":"YZouCtoSz6zTdg9c7tfNNBl5kvo8Fgz1C__8IrsWtieA"}}

Get the API key that is bound to a CRN

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/?boundTo={CRN}::{service ID}
Command
GET
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X GET -H "Accept: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/?boundTo=crn:v1:icp:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f"

The response resembles the following code:

{"currentPage":1,"pageSize":20,"items":[{"metadata":{"uuid":"ApiKey-b730fe51-66b5-4c60-83a4-e3e0416d4d86","createdAt":"2018-05-08T08:11+0000","modifiedAt":"2018-05-08T08:11+0000"},"entity":{"boundTo":"crn:v1:icp:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f","name":"test_serviceid_apikey","description":"Description for test_serviceid_apikey ","format":"APIKEY","apiKey":"OKfUUmsbiK5QF8Yq1_2oiKkDzqAVGaOp504Bnvjn0nxs"}}]}

Get information about an API key

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/{API key}
Command
GET
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X GET -H "Accept: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88"

The response resembles the following code:

{"metadata":{"uuid":"ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88","createdAt":"2018-0
5-08T08:13+0000","modifiedAt":"2018-05-08T08:13+0000"},"entity":{"boundTo":"crn:v1:ic
p:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f
","name":"test_serviceid_apikey","description":"Description for test_serviceid_apikey
","format":"APIKEY","apiKey":"YZouCtoSz6zTdg9c7tfNNBl5kvo8Fgz1C__8IrsWtieA"}}

Update an API key

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/{API key}
Command
PUT
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -d '{"name": "test_serviceid_apikey","description": "Updated Description for test_serviceid_apikey"}' "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88"

The response resembles the following code:

{"metadata":{"uuid":"ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88","createdAt":"2018-0
5-08T08:13+0000","modifiedAt":"2018-05-08T08:24+0000"},"entity":{"boundTo":"crn:v1:ic
p:private:k8::n/kube-system::serviceid:ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f
","name":"test_serviceid_apikey","description":"Updated Description for test_servicei
d_apikey","format":"APIKEY","apiKey":"YZouCtoSz6zTdg9c7tfNNBl5kvo8Fgz1C__8IrsWtieA"}}

Delete an API key

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/{API key}
Command
DELETE
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X DELETE -H "Accept: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/apikeys/ApiKey-1c40ff8e-5b33-441e-b06f-d5cb89cd1a88"

The response resembles the following code:

no content
Response Code: 204

Generate an OpenID Connect (OIDC) token

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/apikeys/{API key}
Command
POST
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" -d 'grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=EiAUSgnt32h800nur9BCPnHlIsOK6G95pH6fNR2T7peZ&response_type=cloud_iam' "https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/oidc/token"

The response resembles the following code:

{"access_token":"eyJraWQiOiIyMDE3MDUxNS0wMDowMDowMCIsImFsZyI6IlJTMjU2In0.eyJpYW1faWQi
OiJpYW0tU2VydmljZUlkLTYzZjZiMjZmLTE1NjgtNGUzZS1iODhjLTc3ODA5Y2VhOGM4ZiIsImlkIjoiaWFtL
VNlcnZpY2VJZC02M2Y2YjI2Zi0xNTY4LTRlM2UtYjg4Yy03NzgwOWNlYThjOGYiLCJyZWFsbWlkIjoiaWFtIi
wic3ViX3R5cGUiOiJTZXJ2aWNlSWQiLCJpYXQiOjE1MjU3NzMyNzQsImV4cCI6MTUyNTg1OTY3NCwiaXNzIjo
iaHR0cHM6Ly9sb2NhbGhvc3Q6MTA0NDMvb2lkYy90b2tlbiIsImdyYW50X3R5cGUiOiJ1cm46aWJtOnBhcmFt
czpvYXV0aDpncmFudC10eXBlOmFwaWtleSIsInNjb3BlIjoib3BlbmlkIiwiY2xpZW50X2lkIjoiZGVmYXVsd
CJ9.Lq68chxg3R7pNbq9Tqd7AUfGYK3Xl8Ec-g6E5oFxgDRKGy3Q-coFNf2X5IDFBqkoX3RqIPdB1gx8oNt2P
cf8vrxnfZCymo949kRtz1fgwUqs7JAtC6etvT54i-Cd_i-M8_2zXI8j0jXeRc58i30bSg34gEHZFikgGuGa3m
J_hxLYUUhtHzN4E_OS578WpQ7GfDkNCSv5aaYSA1fQIwMfF76cTcB8Cb_9d9oUAFyVe5CRGicLuGtULnckVy2
aWLdjM_txu8p7NF_Y5EbD-0plHfrsqpE877jhgTkbtP_p3aBR028q8j8X-a_S5NnIOKsAbAAX_8jIMCBYNRJQ
nXU5Uw","token_type":"Bearer","expires_in":86400,"expiration":1525859674}

Introspect an OIDC token

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
Cluster Master Host
Port number
Cluster Master API Port
Path
/iam-token/oidc/introspect
Command
POST
Command output format
application/json

The sample curl command resembles the following code:

curl -k -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'token=eyJraWQiOiIyMDE3MDUxNS0wMDowMDowMCIsImFsZyI6IlJTMjU2In0.eyJyZWFsbWlkIjoiaWFtIiwic3ViX3R5cGUiOiJTZXJ2aWNlSWQiLCJpYXQiOjE1MjA1ODAyMjcsImV4cCI6MTUyMDY2NjYyNywiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NDQzMC9vaWRjL3Rva2VuIiwiZ3JhbnRfdHlwZSI6InVybjppYm06cGFyYW1zOm9hdXRoOmdyYW50LXR5cGU6YXBpa2V5Iiwic2NvcGUiOiJvcGVuaWQiLCJjbGllbnRfaWQiOiJkZWZhdWx0In0.cJs3O2KFMQj7jM2b3p0ieem0qCeL1wxC5WAFPWBVe7jpicvjmLkww7LJyaT45o_ickH3ehoGCDVyaZZdtYmiMKr2CFdAZvCEbpVKeq2KHqsZVWae_ezjUp2aHyPh9MUjyQKmNaI2dinxqQSHZkXH4nLMrDhsL3VUYhTI786m6crhESuhndZnCJq3otKhy6xFg1woCIxp9L3gWPth2f4srS9z1d-ZXP02mtyGZJUUZJeQA84dP6OC5QjJVlE-clIlq_-xDOk4M16vHX8KSPjKhwv2F5gCV32EhZGUUc-PvsRl5SW5xKpyaRP5VGxHEbunu0aPCsA-JtL6ELbi77sagw' 'https://<Cluster Master Host>:<Cluster Master API Port>/iam-token/oidc/introspect'

The response resembles the following code:

{"active":true,"iss":"https://$MASTER_NODE_IP:10443/oidc/token","realmId":"iam","sub_type":"ServiceId","account":{},"scope":"openid","client_id":"default","iat":1529391495,"exp":1529477895,"grant_type":"urn:ibm:params:oauth:grant-type:apikey","iam_id":"iam-ServiceId-63f6b26f-1568-4e3e-b88c-77809cea8c8f"}