API key management APIs

APIs to manage keys.

Base path: https://<cluster_lb_address>:8443/iam-token/apikeys/

Create an API key

API version
1.0.0
API URI components
Scheme
HTTPS
Host IP
cluster_lb_address
Port number
8443
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_lb_address>:8443/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_lb_address
Port number
8443
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_lb_address>MASTER_NODE_IP:8443/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_lb_address
Port number
8443
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_lb_address>:8443/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_lb_address
Port number
8443
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_lb_address>:8443/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_lb_address
Port number
8443
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_lb_address>:8443/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_lb_address
Port number
8443
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_lb_address>:8443/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}