Adding an SSH Key (Deprecated)
Function
This API is used to configure an SSH key in CodeArts Repo to establish a secure connection between a local computer and a repository under your account.
URI
POST /v1/users/sshkey
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Explanation User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token. Constraints Mandatory Range 1–100,000 characters. Default value None. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Explanation A locally generated SSH key. Constraints None. Range Max. 2,048 digits and letters. Default value None. |
|
title |
Yes |
String |
Explanation A custom title set when the SSH key is added. Range Max. 255 characters. |
Response Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Explanation Response error. Range None. |
|
result |
PublicKey object |
Explanation Response result. Range None. |
|
status |
String |
Explanation Response status of the API. Range
|
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Explanation Error code returned when the API fails to be called. Range
|
|
message |
String |
Explanation Error message returned when the API fails to be called. Range
|
Example Requests
POST https://{endpoint}/v1/users/sshkey
{
"title" : "repo@xxx.com",
"key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@xxx.com"
}
Example Responses
Status code: 200
OK
{
"result" : {
"id" : "1034531",
"title" : "repo@xxx.com",
"key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@xxx.com"
},
"status" : "success"
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
OK |
Error Codes
|
Status Code |
Error Code |
Error Message |
Description |
Measure |
|---|---|---|---|---|
|
409 |
CH.080002 |
The key already exists. Generate a new one. |
The key has been configured in CodeArts Repo. Generate a new one locally. |
Re-generate a key locally and configure it in CodeArts Repo. |
|
200 |
CH.010202 |
Failed to add the key. Check whether the key is valid. |
The key cannot be added in CodeArts Repo. The key or title is invalid. |
|
|
400 |
CH.080002 |
title cannot be left blank |
Title is required. |
Specify a title. |
|
400 |
CH.080002 |
key is empty |
SSH key is required. |
Specify an SSH key. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
