Updated on 2022-08-09 GMT+08:00

Uploading a Certificate

Function

This API is used to upload a certificate to SCM.

URI

  • URI format

    POST /v2/{project_id}/scm/cert/upload

  • Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID.

Request

Request parameters

Parameter

Mandatory

Type

Description

cert_name

Yes

String

Certificate name.

The value is a string of 0 to 63 characters.

cert

Yes

String

Certificate chain content.

private_key

Yes

String

Private key of a certificate.

Response

Response parameters

Parameter

Mandatory

Type

Description

cert_id

Yes

String

Certificate ID.

Example

The following describes how to upload a certificate named test.

  • Example request
    {
        "cert_name":"test",
        "cert":"-----BEGIN CERTIFICATE----- *** -----END CERTIFICATE-----",
        "private_key": "-----BEGIN RSA PRIVATE KEY----- *** -----END RSA PRIVATEKEY-----"
    }
  • Example response
    { 
        "cert_id": " scs1481110651012"
    }

    or

    { 
       "error_code": "SCM.XXXX",  
       "error_msg": "XXXX"   
     }

Status Codes

Table 1 lists the normal status code returned by the API.
Table 1 Status code

Status Code

Status

Description

200

OK

Request processed successfully.

For details about error codes, see Error Codes