可以用swagger在线解析
http://editor.swagger.io/
将swagger.yaml中的内容拷贝到里面即可。
官方文档说明链接如下:
https://github.com/vmware/harbor/blob/master/docs/configure_swagger.md
1. 健康检查
curl -X GET "http://172.25.65.126:8000/api/health" -H "accept: application/json"
2. 根据项目名查询
curl -X GET "http://172.25.65.126:8000/api/search?q=sx628" -H "accept: application/json"
3. 根据拥有者,是否公开查询项目
curl -X GET "http://172.25.65.126:8000/api/projects?name=sx628&public=true&owner=test01" -H "accept: application/json"
4. 查询项目名是否存在
curl -X HEAD "http://172.25.65.126:8000/api/projects?project_name=sx62811" -H "accept: application/json"
5. 新建一个项目
curl -X POST "http://172.25.65.126:8000/api/projects" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"project_name\": \"test073\", \"metadata\": { \"public\": \"true\", \"enable_content_trust\": \"string\", \"prevent_vul\": \"string\", \"severity\": \"string\", \"auto_scan\": \"string\" }}"
6. 获取当前用户
curl -X GET "http://172.25.65.126:8000/api/users/current" -H "accept: application/json"
7. 获取镜像
curl -X GET "http://172.25.65.126:8000/api/search?q=sx628" -H "accept: application/json"
{ "project": [ { "project_id": 3, "owner_id": 3, "name": "sx628", "creation_time": "2019-06-28T08:36:40Z", "update_time": "2019-06-28T08:36:40Z", "deleted": false, "owner_name": "", "togglable": true, "current_user_role_id": 0, "repo_count": 2, "chart_count": 0, "metadata": { "auto_scan": "false", "enable_content_trust": "false", "prevent_vul": "false", "public": "false", "severity": "low" } } ], "repository": [ { "project_id": 3, "project_name": "sx628", "project_public": false, "pull_count": 18, "repository_name": "sx628/harbor", "tags_count": 1 }, { "project_id": 3, "project_name": "sx628", "project_public": false, "pull_count": 6, "repository_name": "sx628/nginx", "tags_count": 1 } ] }
8. 根据用户名,用户邮箱获取
curl -X GET "http://172.25.65.126:8000/api/users/search?username=test02&email=test02%40163.com" -H "accept: application/json"
9. 根据用户id 获取用户的详细信息
curl -X GET "http://172.25.65.126:8000/api/users/3" -H "accept: application/json"
10. 查询用户拥有的项目
curl -X GET "http://172.25.65.126:8000/api/projects?owner=test01" -H "accept: application/json"
[ { "project_id": 2, "owner_id": 3, "name": "test01", "creation_time": "2019-06-28T05:58:47Z", "update_time": "2019-06-28T05:58:47Z", "deleted": false, "owner_name": "", "togglable": true, "current_user_role_id": 0, "repo_count": 0, "chart_count": 0, "metadata": { "public": "false" } }, { "project_id": 3, "owner_id": 3, "name": "sx628", "creation_time": "2019-06-28T08:36:40Z", "update_time": "2019-06-28T08:36:40Z", "deleted": false, "owner_name": "", "togglable": true, "current_user_role_id": 0, "repo_count": 2, "chart_count": 0, "metadata": { "auto_scan": "false", "enable_content_trust": "false", "prevent_vul": "false", "public": "false", "severity": "low" } } ]
11 . 根据项目ID,查询成员信息
curl -X GET "http://172.25.65.126:8000/api/projects/3/members" -H "accept: application/json"
[ { "id": 4, "project_id": 3, "entity_name": "test01", "role_name": "projectAdmin", "role_id": 1, "entity_id": 3, "entity_type": "u" }, { "id": 8, "project_id": 3, "entity_name": "test02", "role_name": "developer", "role_id": 2, "entity_id": 4, "entity_type": "u" }, { "id": 6, "project_id": 3, "entity_name": "test04", "role_name": "guest", "role_id": 3, "entity_id": 5, "entity_type": "u" } ]
12. 获取仓库
curl -X GET "http://172.25.65.126:8000/api/registries" -H "accept: application/json"
[ { "id": 1, "name": "kuai-test", "description": "test", "type": "harbor", "url": "http://172.25.58.1:8000", "token_service_url": "", "credential": { "type": "basic", "access_key": "admin", "access_secret": "*****" }, "insecure": false, "status": "healthy", "creation_time": "2019-06-28T02:45:51.89703Z", "update_time": "2019-07-03T08:33:17.570053Z" } ]
13. 查询标签:全局:G,项目:P
curl -X GET "http://172.25.65.126:8000/api/labels?scope=g" -H "accept: application/json"
[ { "id": 4, "name": "dev", "description": "开发环境", "color": "#0065AB", "scope": "g", "project_id": 0, "creation_time": "2019-07-01T01:57:04.194757Z", "update_time": "2019-07-01T01:57:04.194757Z", "deleted": false }, { "id": 5, "name": "pro", "description": "生产环境", "color": "#C92100", "scope": "g", "project_id": 0, "creation_time": "2019-07-01T02:14:33.467617Z", "update_time": "2019-07-01T02:14:33.467617Z", "deleted": false }, { "id": 3, "name": "test", "description": "测试环境", "color": "#781DA0", "scope": "g", "project_id": 0, "creation_time": "2019-07-01T01:56:46.204878Z", "update_time": "2019-07-01T01:56:46.204878Z", "deleted": false } ]
14. 查询LDAP分组
curl -X GET "http://172.25.65.126:8000/api/ldap/groups/search" -H "accept: application/json"
所有评论(0)