Querying Project List
Function
This API is used to quickly query the project list, including the association between repositories and projects, for repository management and collaboration.
Calling Method
For details, see Calling APIs.
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 |
|---|---|---|---|---|---|
| codeartsartifact:repository:read | Read | - | - | - | - |
URI
GET /v5/maven/project/repository
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| search_name | No | String | Definition Project name. Fuzzy query is supported. Constraints N/A Range A maximum of 200 characters are allowed. Default value N/A |
| offset | No | Integer | Definition Start position for pagination query. Constraints N/A Range 0–2,147,483,647 Default value 0 |
| limit | No | Integer | Definition Number of records on each page in a pagination query. Constraints N/A Range 1–2,147,483,647 Default value 10 |
| repo_id | No | 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 Repo URL. For example, if the repository address is https://devrepo.devcloud.abcde.abc.xyz.com/artgalaxy/abcde_09d2ca2f5080d5b60f51c00ae5bad0a0_maven_2_50/, abcde_09d2ca2f5080d5b60f51c00ae5bad0a0_maven_2_50 is the repository ID. Constraints N/A Range The following types are supported in the repository ID: Default value N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Status of the project list query, which can be successful or failed. Range |
| trace_id | String | Definition Request ID, which uniquely identifies the current request. Range A string of digits and hyphens (-). |
| result | PrivilegeProjectInfoV5 object | Definition Response to the request, which is the project object. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Project sequence number. Range N/A |
| name | String | Definition Project name. Range N/A |
| status | String | Definition Project status (This parameter does not return any value. Ignore it.) Range No value is returned for this parameter. Ignore it. |
| project_id | String | Definition Project ID. Range N/A |
| created_time | String | Definition Time when the project is created. Range Format: yyyy-MM-dd HH:mm:ss |
| repository_num | Integer | Definition Number of repositories. Range N/A |
| total | Integer | Definition Total number of projects (This parameter does not return any value. Ignore it.) Range No value is returned for this parameter. Ignore it. |
| repository_id | String | Definition Repository ID. Range N/A |
| region | String | Definition Region of the project. Range N/A |
| domain_id | String | Definition Tenant ID. Range N/A |
| ids | Array of strings | Definition Project sequence number list. (This parameter does not return any value. Ignore it.) Range No value is returned for this parameter. Ignore it. |
| total_records | Integer | Definition Total number of projects. Range N/A |
| associated | Boolean | Definition Whether the repository ID in the request is associated with the project. Range |
| project_info | Array of PrivilegeProjectInfoV5 objects | Definition Project information. Range N/A |
Example Requests
This API is used to query the project list.
https://{endpoint}/v5/maven/project/repository?search_name=Subuser deletion test &repo_id=aa-bbbbb-c_09d2ca2f5080d5b60f51c00ae5bad0a0_maven_5_44&offset=0&limit=10 Example Responses
Status code: 200
The project management interconnection list is queried successfully.
{
"status" : "success",
"trace_id" : "143006-1760344958153-39922",
"result" : {
"id" : null,
"name" : null,
"status" : null,
"total" : 1,
"region" : null,
"ids" : null,
"associated" : false,
"project_id" : null,
"created_time" : null,
"repository_num" : 0,
"repository_id" : null,
"domain_id" : null,
"project_info" : [ {
"id" : null,
"name" : "Subuser Deletion Test",
"status" : null,
"total" : 0,
"region" : null,
"ids" : null,
"associated" : false,
"project_id" : "b6c5c65138f24847acc3acaae9d009d8",
"created_time" : "2025-08-27 16:56:11",
"repository_num" : 1,
"repository_id" : null,
"domain_id" : null,
"project_info" : null,
"total_records" : 0
} ],
"total_records" : 1
}
} SDK Sample Code
The SDK sample code is as follows.
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.codeartsartifact.v2.region.CodeArtsArtifactRegion; import com.huaweicloud.sdk.codeartsartifact.v2.*; import com.huaweicloud.sdk.codeartsartifact.v2.model.*; public class ShowProjectRelatedRepositorySolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new BasicCredentials() .withAk(ak) .withSk(sk); CodeArtsArtifactClient client = CodeArtsArtifactClient.newBuilder() .withCredential(auth) .withRegion(CodeArtsArtifactRegion.valueOf("<YOUR REGION>")) .build(); ShowProjectRelatedRepositoryRequest request = new ShowProjectRelatedRepositoryRequest(); try { ShowProjectRelatedRepositoryResponse response = client.showProjectRelatedRepository(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkcodeartsartifact.v2.region.codeartsartifact_region import CodeArtsArtifactRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcodeartsartifact.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = BasicCredentials(ak, sk) client = CodeArtsArtifactClient.new_builder() \ .with_credentials(credentials) \ .with_region(CodeArtsArtifactRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowProjectRelatedRepositoryRequest() response = client.show_project_related_repository(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" codeartsartifact "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartsartifact/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := codeartsartifact.CodeArtsArtifactClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := codeartsartifact.NewCodeArtsArtifactClient(hcClient) request := &model.ShowProjectRelatedRepositoryRequest{} response, err := client.ShowProjectRelatedRepository(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | The project management interconnection list is queried successfully. |
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