Updated on 2023-11-23 GMT+08:00

Creating a Node Certificate

Function

This API is used to create application and device certificates for an edge node.

URI

POST /v2/{project_id}/edgemgr/nodes/{node_id}/certs

Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

node_id

Yes

Node ID.

Request

Request parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

name

Yes

String

Certificate name.

description

No

String

Certificate description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

type

Yes

String

Certificate type. The options are as follows:

  • application: Application certificate.
  • device: Device certificate.

Example request

{
    "name": "app-cert",
    "description": "",
    "type": "application"
}

Response

Response parameters

Table 4 Parameters in the response body

Parameter

Type

Description

id

String

Certificate ID.

name

String

Certificate name.

description

String

Certificate description.

created_at

String

Time when the certificate is created.

node_id

String

Node ID.

type

String

Certificate type. The options are as follows:

  • system: A system certificate is created by default when a node is registered.
  • application: Application certificate.
  • device: Device certificate.

serial_num

String

Certificate SN.

ca

String

Root certificate.

certificate

String

Certificate.

private_key

String

Private key.

package

String

Base64-encoded character string. This value is obtained after Base64 encoding is performed on the .tar.gz package of the certificate, root certificate, and private key.

Before use, decode it into a .tar.gz package using Base64.

Example response

{
    "id": "243931b3-2651-4147-becc-d4215c8c2296",
    "name": "app-cert",
    "description": "",
    "created_at": "2020-09-22T17:55:41.577635881Z",
    "node_id": "9ebd8efb-9fdd-44a1-abda-9cdbc287a867",
    "type": "application",
    "serial_num": "",
    "ca": "",
    "certificate": "",
    "private_key": "",
    "package": ""
}

Error Codes

For details, see Error Codes.