...
NOTE: You will notice that now the Set-Cookie response is settings the id cookie to an empty string - this clears your auth cookie from the browser, so you may discard the cookie that you received above as it may no longer be valid.
User API Keys
Relevant endpoints:
...
For simplicity, you can manage your User API keys in the Clowder UI:
- Log into Clowder
- At the top-right expand the dropdown containing your user profile picture
- Select "View Profile" from the dropdown
This will take you to the /profile/viewProfile/{user-id}
view that will list your existing API keys, as well as allowing you to create and delete them:
You can also use the REST API to generate a new API key, but you'll need to authenticate manually first.
...
These endpoints can be used to create a user-specific API key for interacting with the Clowder API.
Creating a Key via REST API
Relevant endpoints:
POST /api/users/keys?name={key-name}
To create a new API key with the given name for the currently-logged-in user:
...
Code Block | ||
---|---|---|
| ||
$ curl --insecure http://localhost:9000/api/datasets?key=839785b9-5e23-4a1b-92f7-259294a58aed -vvv * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 9000 (#0) > GET /api/datasets?key=839785b9-5e23-4a1b-92f7-259294a58aed HTTP/1.1 > Host: localhost:9000 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < Access-Control-Allow-Origin: * < Access-Control-Allow-Headers: < Access-Control-Allow-Methods: * < Access-Control-Allow-Credentials: true < Content-Type: application/json; charset=utf-8 < Content-Length: 411 < * Connection #0 to host localhost left intact [{"id":"5b4e510577c8fff0a479786c","name":"asdf","description":"","created":"Tue Jul 17 15:26:45 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5b0724b277c85c0c70e371d8"]},{"id":"5ad7b5b377c8a52d73b2ac5f","name":"test_dataset","description":"","created":"Wed Apr 18 16:16:35 CDT 2018","thumbnail":"None","authorId":"5ad76e39693ea57ec7f8648a","spaces":["5ad7b4b777c8a52d73b2ac48"]}] |
Retrieving Keys via REST API
Relevant endpoints:
GET /api/users/keys
GET /api/users/keys/{key-name}
To retrieve a list of all existing API keys for this user:
...
Code Block | ||
---|---|---|
| ||
$ curl --insecure http://localhost:9000/api/users/keys/testkey --cookie 'id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13' -vvv * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 9000 (#0) > GET /api/users/keys/testkey HTTP/1.1 > Host: localhost:9000 > User-Agent: curl/7.54.0 > Accept: */* > Cookie: id=2859bdc9050ec48ea779db10bc1f54dda37e75ebc13d1c65bad0f90810159b5047df7b67dd7802b64ad7eb1dff9b4355fc67a26a9a009fffcb9de1aa5b31b7a1739553da9cfcd0d060fb11cdf96a1fadf94fd3f49afb50a4b5df6b7a9a460cbbce37d3aa012bca3b77c921f6038dd2cc618ac4f0958e33da39d5b5948c07ab13 > < HTTP/1.1 200 OK < Access-Control-Allow-Origin: * < Access-Control-Allow-Headers: < Access-Control-Allow-Methods: * < Access-Control-Allow-Credentials: true < Content-Type: application/json; charset=utf-8 < Content-Length: 135 < * Connection #0 to host localhost left intact {"name":"testkey","key":"22da6ca7-1c66-4612-bc4d-368f92ecf9bf","identityId":{"userId":"lambert8@illinois.edu","providerId":"userpass"}} |
Deleting Keys via REST API
Relevant endpoints:
DELETE /api/users/keys/{key-name}
To delete an existing API key:
...