Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ Repository/ Associating a Common Repository with a Remote Image
Updated on 2026-01-27 GMT+08:00

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.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsrepo:repository:setRepository

Write

-

-

-

-

URI

POST https://{hostURL}/v4/repositories/{repository_id}/remote-mirror/associate

Table 1 Path Parameters

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

Default Value

N/A

Value range:

1~2147483647

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token.

Constraints

N/A

Range

1–100,000 characters.

Default Value

N/A

Response Parameters

Status code: 201

Table 3 Response body parameters

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

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 404

Table 6 Response body parameters

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.