An API Key is specific to a user and allows access to the API with the key replacing the usage of user credentials for authentication.
The REST API provides support for a number of operations:
Creates a new API key for a user.
/api/v1/apikey
POST
Authorization
, Content-Type: application/json
{
"username": "myLdapUsername",
"userDomain": "optional.domain.com"
}
Content-Type: application/json
{
"ok": true,
"id": "3b45a52f-91d7-4dd0-8bf6-b06548e0afa5",
"key": "someGeneratedKeyValue"
}
curl -u myLdapUser \
-X POST \
-H "Content-Type: application/json" \
-d '{ "username": "myLdapUser" }' \
http://concord.example.com/api/v1/apikey
curl -u myLdapUser \
-X POST
-H "Content-Type: application/json" \
-d '{ "username": "myLdapUser", "name": "myCustomApiKeyName" }' \
http://concord.example.com/api/v1/apikey
curl -u [email protected] \
-X POST \
-H "Content-Type: application/json" \
-d '{ "username": "myLdapUser", "userDomain": "example.com" }' \
http://concord.example.com/api/v1/apikey
Lists any existing API keys for the user. Only returns metadata, not actual keys.
/api/v1/apikey
GET
Authorization
, Content-Type: application/json
Content-Type: application/json
[
{
"id" : "2505acba-314d-11e9-adf9-0242ac110002",
"userId": "aab8a8e2-2f75-4859-add1-3b8f5d7a6690",
"name" : "key#1"
}, {
"id" : "efd12c7a-3162-11e9-b9c0-0242ac110002",
"userId": "aab8a8e2-2f75-4859-add1-3b8f5d7a6690",
"name" : "myCustomApiKeyName"
}
]
curl -u myLdapUser \
-H "Content-Type: application/json" \
http://concord.example.com/api/v1/apikey
Removes an existing API key.
/api/v1/apikey/${id}
DELETE
Authorization
Content-Type: application/json
{
"result": "DELETED",
"ok": true
}
curl -u myLdapUser \
-X DELETE \
-H "Content-Type: application/json" \
http://concord.example.com/api/v1/apikey/2505acba-314d-11e9-adf9-0242ac110002
When accessing the Concord API, the Authorization header can be set with the value of an API key. This replaces the need to authenticate with user and password.
curl \
-H "Content-Type: application/json" \
-H "Authorization: someGeneratedKeyValue" \
http://concord.example.com/api/v1/apikey