Associating a Common Repository with a Remote Image
Function
This API is used to associate a common repository with a remote image.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST https://{hostURL}/v4/repositories/{repository_id}/remote-mirror/associate
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| repository_id | Yes | Integer | Definition You can query the project list to obtain the repository ID by calling the API used to query user's all repositories. Constraints N/A. Value range: 1~2147483647 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints Mandatory. Range 1–100,000 characters. Default Value N/A. |
Response Parameters
Status code: 201
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Repository image configuration ID. |
| repository_id | Integer | Definition Repository ID. |
| update_status | String | Definition Synchronization status. |
| last_update_at | String | Definition Last modification time. |
| url | String | Definition Image address. |
| last_successful_update_at | String | Definition Last successful synchronization time. |
| number_of_failures | Integer | Definition Number of synchronization failures. |
| mirroring_enabled | Boolean | Definition Enable scheduled synchronization. |
| is_private | Boolean | Definition Private image. |
| endpoint_uuid | String | Definition Endpoint UUID. |
| last_error | String | Definition Last failure information. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Example Requests
This API is used to associate a common repository with a remote image.
POST /v4/repositories/123/remote-mirror/associate
{
"url" : "https://example.com/0379d2da2bae4c38b3d2fbbdb6f2a3f2/test.git"
} Example Responses
Status code: 201
Image information.
{
"id" : 12439,
"repository_id" : 2112029391,
"update_status" : "finished",
"last_update_at" : "2025-04-24T20:04:44.000+08:00",
"url" : "https://example.com/0379d2da2bae4c38b3d2fbbdb6f2a3f2/test.git",
"last_successful_update_at" : "2025-04-24T20:04:44.000+08:00",
"number_of_failures" : null,
"mirroring_enabled" : false,
"is_private" : false,
"endpoint_uuid" : null,
"last_error" : null
} Status code: 401
Unauthorized
{
"error_code" : "CH.00000002",
"error_msg" : "Recognize authentication information failed."
} Status code: 403
Bad Request
{
"error_code" : "CH.00401001",
"error_msg" : "No access permission."
} Status code: 404
Not Found
{
"error_code" : "CH.00402000",
"error_msg" : "The repository does not exist. Check and try again."
} Status Codes
| Status Code | Description |
|---|---|
| 201 | Image information. |
| 401 | Unauthorized |
| 403 | Bad Request |
| 404 | Not Found |
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.