create_api_key
12.1 and later This command creates an API key for a Guardium user.
GuardAPI syntax
create_api_key parameter=valueParameters
| Parameter | Value type | Description |
|---|---|---|
| name | String | Required. The name of the API key must not contain the "-" character. |
| username | String | If not specified, the username is set to the logged-in user. If specified, the logged-in user must have the accessmgr role to associate the API key to the username. |
GuardAPI example
The following example shows the command to create an API key that can be used to
get an access token for the Vulnerability Assessment
scanner.
grdapi create_api_key name=vascannerThe output looks similar to
this:ID=0 Encoded API key: ZDBkOGI1ODEtYjZmNi00OWI5LTlmODMtMWVmMWQzMjBlOWU0Use
this key for the CLIENT_API_KEY variable in your environment variable file.The following example shows the command to create an API key grdscripts for
the admin user and then use the output to get an access token for subsequent API
calls.
grdapi create_api_key name=grdscripts username=adminThe output looks
similar to this:ID=0 Encoded API key: <Encoded API Key>Use this output to
get the access token. Then, use the access token for subsequent REST API
calls:curl -k -X POST -H "Authorization: HOBA <Encoded API Key>" https://<hostname>:8443/oauth/token
This cURL command is a REST API call to get the list of managed units for a central
manager:curl -k -X GET -H "Authorization: Bearer <access_token>" https://<hostname>:8443/restAPI/managed_unitsThe following example shows the command to create an API key that can be used to
get an access token for the Vulnerability Assessment
scanner.
grdapi create_api_key name=vascannerThe output looks similar to
this:ID=0 Encoded API key: ZDBkOGI1ODEtYjZmNi00OWI5LTlmODMtMWVmMWQzMjBlOWU0Use
this key for the CLIENT_API_KEY variable in your environment variable file.