Help Center/ CodeArts Artifact/ API Reference/ API/ Audit Logs/ Querying Audit Logs about a Repository or File
Updated on 2025-12-05 GMT+08:00

Querying Audit Logs about a Repository or File

Function

This API is used to query audit logs about a repository or file.

Calling Method

For details, see Calling APIs.

URI

GET /cloudartifact/v5/{tenant_id}/{project_id}/{module}/{repo}/audit

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

tenant_id

Yes

String

Definition

Tenant ID.

Constraints

The value can contain 8 to 32 characters. Only letters and digits are supported.

Range

N/A.

Default value

None

project_id

Yes

String

Definition

Project ID, which can be obtained by calling an API or from the console. For details about how to obtain the project ID, see Obtaining a Project ID (CloudArtifact_api_0015.xml).

Constraints

The value contains 32 characters. Only letters and digits are supported.

Range

N/A.

Default value

None

module

Yes

String

Definition

Module.

Constraints

N/A.

Range

file

repository

Default value

None

repo

Yes

String

Definition

Repository ID. The format is {region}{domainId}{format}_{sequence}. You can find the repository ID on the general page of your self-hosted repos. It is the string located between the last two slashes (/) in the repository URL.

Constraints

The region and domainId in the repository ID must be valid values. The valid values of format are npm, go, pypi, rpm, composer, maven, debian, conan, nuget, docker2, cocoapods, and ohpm. The upper limit of sequence varies depending on the package.

Range

N/A.

Default value

None

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

user_id

No

String

Definition

User ID.

Constraints

N/A.

Range

N/A.

Default value

None

instance_id

No

String

Definition

Instance ID.

Constraints

N/A.

Range

N/A.

Default value

None

page_num

No

Integer

Definition

Number of pages in a pagination query.

Constraints

N/A.

Range

1–2,147,483,647

Default value

1

page_size

No

Integer

Definition

Number of records on each page during the pagination query.

Constraints

N/A.

Range

1–100

Default value

10

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

status

String

Definition

Request status.

Range

success: The request is successful.

error: The request fails.

trace_id

String

Definition

Request ID, which uniquely identifies the current request.

Range

A string of digits and hyphens (-).

result

AuditResult object

Definition

Audit log information.

Range

N/A.

Table 4 AuditResult

Parameter

Type

Description

auditInfoList

Array of AuditDO objects

Definition

Audit log list.

Range

N/A.

total

Integer

Definition

Number of audit logs.

Range

N/A.

Table 5 AuditDO

Parameter

Type

Description

id

String

Definition

Operation ID.

Range

N/A. id

module

String

Definition

Operation module.

Range

N/A.

operation

String

Definition

Operation type.

Range

N/A.

time

String

Definition

Operation time.

Range

N/A.

info

String

Definition

Operation information.

Range

N/A.

data

String

Definition

Operation data.

Range

N/A.

reason

String

Definition

Cause.

Range

N/A.

userAgent

String

Definition

Client type of the operator.

Range

N/A.

operator

String

Definition

Operator.

Range

N/A.

operatorNickName

String

Definition

Operator name.

Range

N/A.

operatorTenantName

String

Definition

Tenant name of the operator.

Range

N/A.

ipSource

String

Definition

IP address of the operator.

Range

N/A.

Example Requests

This API is used to query audit logs about a repository or file.

https://artifact.example.myhuaweicloud.com/cloudartifact/v5/00000000000000000000000000000000/00000000000000000000000000000000/file/xx-xxxxx-x_5a775fdcb14f4431b6c0015618140bc3_maven_1_108/audit?page_num=1&page_size=5

Example Responses

Status code: 200

OK

{
  "status" : "success",
  "trace_id" : "143002-1701222589443-431",
  "result" : {
    "auditInfoList" : [ {
      "id" : "2271182",
      "module" : "file",
      "operation" : "upload",
      "time" : "2023/10/27 15:46:19",
      "info" : "xx-xxxxx-x_5a775fdcb14f4431b6c0015618140bc3_maven_1_108",
      "data" : "1/1/1/1-1-1.jar",
      "reason" : null,
      "userAgent" : "Apache-HttpClient/4.5.13 (Java/1.8.0_232)",
      "operator" : "devcloud_devcloud_y00226182_01",
      "ipSource" : "10.172.180.79"
    } ],
    "total" : 1
  }
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.