Adding a Deploy Key
Function
This API is used to add a deployment key.
URI
POST /v2/repositories/{repository_id}/deploy-keys
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
repository_id |
Yes |
Integer |
Explanation: Repository ID. Constraints: N/A Range: 1–2147483647 Default value: N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Explanation: User token. It can be obtained by calling the corresponding Obtaining a User Token. The value of X-Subject-Token in the response header is the user token. Constraints: N/A Range: 1–100,000 characters. Default value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
application |
Yes |
String |
Explanation: Source of the SSH key for deployment. Constraints: N/A Range: N/A Default value N/A |
|
can_push |
Yes |
Boolean |
Explanation: Whether the SSH key for deployment can push code. Constraints: N/A Range: false: Code cannot be pushed. Default value N/A |
|
key |
Yes |
String |
Explanation: SSH key for deployment. Constraints: N/A Range: N/A Default value N/A |
|
key_title |
Yes |
String |
Explanation: Name of the SSH key for deployment. Constraints: N/A Range: 1–255 Default value N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
error |
Error object |
Explanation: Response error code. Range: N/A |
|
result |
Key object |
Explanation: Response result. Range: N/A |
|
status |
String |
Explanation: Response status. Range:
|
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Explanation: Error code. Range: Max. 100 characters in the error code format. |
|
message |
String |
Explanation: Error message. Range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
can_push |
Boolean |
Explanation: Whether to allow push. Range:
|
|
created_at |
String |
Explanation: Creation time of the deploy key. Range: None |
|
key |
String |
Explanation: Deploy key. Range: None |
|
key_id |
String |
Explanation: Deploy key ID. Range: 1-40 |
|
key_title |
String |
Explanation: Deploy key name. Range: None |
Example Requests
POST https://{endpoint}/v2/repositories/{repository_id}/deploy-keys
{
"key_title" : "repo@example.com",
"key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@example.com",
"can_push" : true,
"application" : ""
}
Example Responses
Status code: 200
OK
{
"result" : {
"key_id" : "1034546",
"key_title" : "repo@example.com",
"key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@example.com"
},
"status" : "success"
}
Status Code
|
Status Code |
Description |
|---|---|
|
200 |
OK |
Error Codes
See Error Codes.
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