Create key metadata (POST /v1/{tenant_id}/secrets)
Creates key metadata.
{tenant_id}: Project ID used to register key metadata
Request headers
X-Auth-Token
Specify the authentication token.
Data type | Cardinality |
---|---|
String | 1..1 |
Content-Type
Specify the request body type.
Valid values: application/json
Data type | Cardinality |
---|---|
String | 1..1 |
Request parameters
None
Request body
name
Key name
Valid characters: Halfwidth alphanumeric characters and halfwidth symbols
Number of characters: 1 to 255
If omitted, the resource ID of the key metadata is used
Data type | Cardinality |
---|---|
String | 0..1 |
expiration
Key expiry datetime Value is returned in ISO-8601 format. When the expiry datetime is reached, the key is automatically deleted. If omitted, null is used, and the information will not be deleted automatically.
Format: YYYY-MM-DDThh:mm:ss.SSSSSSData type
Data type | Cardinality |
---|---|
datetime | 0..1 |
payload
Payload of the key metadata to be registered.
While payload is optional, if it is specified, a null string cannot be used. To escape line feeds, specify "\n".
Line feeds can be specified as is.
Example: "-----BEGIN XXXX-----
> MIIEowIBAAKCAQEAuyWf1R49q5ccq60LoJ1MHf0lQ"
>-----END XXXX-----
If "text/plain" is specified for payload_content_type, the value must meet the following conditions:
- It must include a segment beginning with "-----BEGIN XXX-----" and ending in "-----END XXX-----"
- The segment beginning with "-----BEGIN XXX-----" and ending in "-----END XXX-----", only the following characters are valid:
- Up to 64 characters per line
- A-Z, a-z, 0-9, +/=
Number of characters: Unlimited (the actual limit is the number of bytes for Body)
Data type | Cardinality |
---|---|
String | 0..1 |
payload_content_type
Format to use in the response for the key information payload
This is required if "payload" is specified
Valid values: "text/plain", "text/plain;charset=utf-8","text/plain; charset=utf-8", "application/octet-stream"
Data type | Cardinality |
---|---|
Enum("text/plain", "text/plain;charset=utf-8","text/plain; charset=utf-8", "application/octet-stream") | 0..1 |
payload_content_encoding
Encryption format
This item cannot be specified if any of the following are specified for payload_content_type: "text/plain", "text/plain;charset=utf-8", "text/plain; charset=utf-8"
This item is required if "application/octet-stream" is specified for payload_content_type
Valid value: base64
Data type | Cardinality |
---|---|
Enum(base64) | 0..1 |
Response headers
Status
The following error codes can be returned for the request.
One of the following values will be returned.
- 201:
- Normal completion
- 401:
- Authentication error (no authentication token, incorrect authentication token, etc.)
- 400:
- Invalid access (invalid parameter, etc.)
- 403:
- Cannot access (no privileges)
- 404:
- No applicable resources
- 413:
- The key metadata exceeds 10000 bytes
- 415:
- An unsupported Content-Type was specified
- 500:
- Unexpected error
Data type | Cardinality |
---|---|
int | 1..1 |
Response elements
secret_ref
Resource URI allocated to the registered key metadata
Data type | Cardinality | Parent element | Child element |
---|---|---|---|
String | 1..1 | None | None |
Example of request
POST /v1/a759452216fd41cf8ee5aba321cfbd49/secrets
X-Auth-Token: "JpZCI6ICJjM2VlNzA4YTZhZTI0ZGRmOTJjMDc4 . . ."
Content-Type: "application/json"
Body:
{
"name": "key1",
"expiration": "2015-02-28T19:14:44.180394",
"payload":"-----BEGIN XXXX-----MIIEow . . . Rwg7Jp-----END XXXX-----",
"payload_content_type": "text/plain",
"payload_content_encoding": "base64"
}
Example of response
Status Code: 201 Created
Content-Length: 118
Content-Type: application/json; charset=UTF-8
Location: http://<host>:9311/ a759452216fd41cf8ee5aba321cfbd49/secrets/a417d40d-cec7-4129-a5ad-afaac6fab603
{"secret_ref": "http://<host>:9311/v1/ a759452216fd41cf8ee5aba321cfbd49/secrets/a417d40d-cec7-4129-a5ad-afaac6fab603"}