Create Root cert

Description

Create new root cert.This request creates a root certificate if it does not already exists. If it does exists it is replaced with the new certificate. The certificate can be prepared as a json string with newlines with the following command: awk '$1=$1' ORS='\\n'

Alternatively prepare a cert.json file it makes the command simpler since the certificates can be tricky on the command line. curl -XPUT "https://api.cloud.nabto.com/v1/root-certs/:certId" \ -H "Authorization: Bearer apikey" \ -H "Content-Type: application/json" \ -d @cert.json

This function is only available to administrators.

Request

PUT /v1/root-certs/:certId
{
  rootCert:string,
  tags?: {
    [key: string]: string
  }
}

Response

Successful response contains the following JSON formated body:

{
  certId: string,
  rootCert: string,
  tags: {
    [key: string]: string
  },
  created: string
}

Response Status codes:

  • 200 on success

  • 403 if not administrator

Request headers

This request must have the following headers:

  • Authorization: bearer <ApiKey>
  • Content-Type: application/json

Example

Request

curl -XPUT "https://api.cloud.nabto.com/v1/root-certs/:certId" \
  -H "Authorization: Bearer <ApiKey>" \
  -H "Content-Type: application/json" \
  -d '{ rootCert: "<rootCert>", tags: {"foo": "bar" }}'

Response

{
   certId: "<certId>",
  rootCert: "<rootCert>",
  tags: {
    "foo": "bar" 
  },
  created: "2022-10-18T10:17:24.299Z"
}