Adding a Deploy Key
Function
This API is used to add a deploy key.
URI
POST /v2/repositories/{repository_id}/deploy-keys
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repository_id |
Yes |
Integer |
Repository primary key ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It 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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
application |
Yes |
String |
Source of the SSH key for deployment. |
can_push |
Yes |
Boolean |
Whether the SSH key for deployment can push code. |
key |
Yes |
String |
SSH key for deployment. |
key_title |
Yes |
String |
Name of the SSH key for deployment. |
Response Parameters
Status code: 200
Example Requests
POST https://{endpoint}/v2/repositories/{repository_id}/deploy-keys { "key_title" : "repo@huawei.com", "key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@huawei.com", "can_push" : true, "application" : "" }
Example Responses
Status code: 200
OK
{ "result" : { "key_id" : "1034546", "key_title" : "repo@huawei.com", "key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@huawei.com" }, "status" : "success" }
Status Codes
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.