Editing the configuration of an access key or an SSH key

Edit the configuration of an access key or an SSH key.

Method and URI

To edit the configuration value of an access key, use the PUT method with a URI:

PUT     https://{hostname|IPv4}/api/identity/{identityKeyId}

Tip

To get an {identityKeyId}, follow the instructions in Getting an {identityKeyId}.

Parameters

None.

Data

The same as the available Data key-value pairs in Adding an access key and Adding an SSH key.

Example

Assume that you want to edit the access key BlueMachines IBM Amazon S3 US-East1 Key ({identityKeyId} 1005). You want to assign the following values to this access key:

  • Name: BlueMachines IBM COS Singapore Key

  • Access key: FD82Hf2w37tqq2sX9Uye

  • Secret key: fVBvcjgJvbjvuWBPU7uVzTJc47CNNJtQmnJNJted

Run the following command:

identity_key_id = "1005"

_data = f'''{{
    "name":   "BlueMachines IBM COS Singapore Key,
    "access": "FD82Hf2w37tqq2sX9Uye"
    "secret": "fVBvcjgJvbjvuWBPU7uVzTJc47CNNJtQmnJNJted"
}}'''

requests.put('https://' + spp_ipv4 + '/api/identity/key/' + identity_key_id,
    headers={...}, params="", data=_data, verify=...)

After you run the Python snippet, ensure that you get a response with the HTTP status of 200 (OK) and that the access key settings are updated. This request is similar to the one that you used to create the access key; compare the HTTP request method, the URI, the data values, and the HTTP status code in the response. The response body is similar to the JSON object for the original access key, as shown in Getting information about access keys and SSH keys.