Example 2: Querying Details About a Specified Repository by Repository UUID
Scenario
This section uses a CodeArts user as an example to describe how to use an API to query details about a specified repository.
For details on how to call APIs, see Calling APIs.
Prerequisites
You have enabled CodeArts Repo on the CodeArts console.
Approach
Use the API to view the list of all repositories, obtain the UUID of the repository to be viewed, and use the UUID to query details about the repository in the API. The procedure is as follows:
Step 1: Querying All Repositories of a User
- API information:
URI: GET v2/projects/repositories
- Request example:
GET https://codehub-ext.ap-southeast-3.myhuaweicloud.com/v2/projects/repositories
- Response example:
{ "result": { "total": 40, "repositories": [ { "star": false, "status": 5, "userRole": null, "repository_uuid": "25c88b23d4dc400fa7b3e2a152e4d53c", "repository_id": 522140, "repository_name": "1111111111111", "ssh_url": "git@codehub.devcloud.cn-north-208.ulanqab.huawei.com:testzxq00001/1111111111111.git", "https_url": "https://codehub.devcloud.cn-north-208.ulanqab.huawei.com/testzxq00001/1111111111111.git", "group_name": "testzxq00001", "web_url": "https://devcloud.cn-north-208.ulanqab.huawei.com/codehub/522140/home", "visibility_level": 0, "created_at": "2020-07-22 10:45:56", "updated_at": "2020-07-22 10:45:56", "repository_size": "0.16M", "lfs_size": "0.00M", "creator_name": "devcloud_codehub_l00314597_01", "domain_name": "devcloud_codehub_l00314597_01", "is_owner": 1, "iam_user_uuid": "a618e34bd5704be3ae3395dfede06041", "project_uuid": "a689e057c2304abfa35d4ff65630a90a", "project_is_deleted": "false" } ] }, "status": "success"}
Step 2: Querying Details About a Repository
- API information:
URI: GET v2/repositories/{project_uuid}
- Request example:
GET https://codehub-ext.ap-southeast-3.myhuaweicloud.com/v2/repositories/73de3f67b30a46a4a7305f3be980c3b1
- Response example:
{ "result": { "star": null, "status": null, "userRole": null, "repository_uuid": "25c88b23d4dc400fa7b3e2a152e4d53c", "repository_id": 522140, "repository_name": "1111111111111", "ssh_url": "git@codehub.devcloud.cn-north-208.ulanqab.huawei.com:testzxq00001/1111111111111.git", "https_url": "https://codehub.devcloud.cn-north-208.ulanqab.huawei.com/testzxq00001/1111111111111.git", "group_name": "testzxq00001", "web_url": "https://devcloud.cn-north-208.ulanqab.huawei.com/codehub/522140/home", "visibility_level": 0, "created_at": "2020-07-22 10:45:56", "updated_at": null, "repository_size": null, "lfs_size": null, "creator_name": null, "domain_name": null, "is_owner": null, "iam_user_uuid": null, "project_uuid": "a689e057c2304abfa35d4ff65630a90a", "project_is_deleted": "false" }, "status": "success" }
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