-
Notifications
You must be signed in to change notification settings - Fork 0
GitLab API
Fengshuang Li edited this page Dec 22, 2016
·
1 revision
basepath: /api/v1
Sample url:
http://175.186.199.226:10010/api/v1/session/login?username=fengshuangli&password=fengshuangli
Output:
{
"message": "ok",
"token": "ZVkzJ9yxYcRhBehBaEai"
}
Sample url:
http://175.186.199.226:10010/api/v1/classes
Output:
[
{
"id": 16,
"name": "HumanEvolution",
"path": "HumanEvolution-2016",
"description": "",
"visibility_level": 20,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/HumanEvolution-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 15,
"name": "IntroductionToCellBiology",
"path": "IntroductionToCellBiology-2016",
"description": "",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/IntroductionToCellBiology-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 14,
"name": "BiotechnologyInDailyLife",
"path": "BiotechnologyInDailyLife-2016",
"description": "",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/BiotechnologyInDailyLife-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 13,
"name": "ImmunologyAndHealth",
"path": "ImmunologyAndHealth-2016",
"description": "",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/ImmunologyAndHealth-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 12,
"name": "PrinciplesOfPhysiologyAndHumanHealth",
"path": "PrinciplesOfPhysiologyAndHumanHealth-2016",
"description": "",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/PrinciplesOfPhysiologyAndHumanHealth-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 11,
"name": "CurrentDrugTherapy",
"path": "CurrentDrugTherapy-2016",
"description": "",
"visibility_level": 10,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/CurrentDrugTherapy-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 10,
"name": "ExperimentsInGeneralBiology",
"path": "ExperimentsInGeneralBiology-2016",
"description": "",
"visibility_level": 20,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/ExperimentsInGeneralBiology-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 9,
"name": "ScienceOfLife",
"path": "ScienceOfLife-2016",
"description": "",
"visibility_level": 20,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/ScienceOfLife-2016",
"request_access_enabled": true,
"semester": "2016"
},
{
"id": 8,
"name": "Meow",
"path": "Meow-2016",
"description": "Meow-test",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/Meow-2016",
"request_access_enabled": true,
"semester": "2016"
}
]
Sample url:
http://175.186.199.226:10010/api/v1/classes/8
Output:
{
"id": 8,
"name": "Meow",
"path": "Meow-2016",
"description": "Meow-test",
"visibility_level": 0,
"lfs_enabled": true,
"avatar_url": null,
"web_url": "http://git.htcnet.moe/groups/Meow-2016",
"request_access_enabled": true,
"shared_projects": [],
"semester": "2016",
"assignments": [
{
"id": 5,
"description": "d-1",
"default_branch": "master",
"ssh_url_to_repo": "[email protected]:Meow-2016/Meow-2016-test-1.git",
"http_url_to_repo": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1",
"name": "Meow-2016-test-1",
"name_with_namespace": "Meow-2016 / Meow-2016-test-1",
"container_registry_enabled": true,
"builds_enabled": true,
"created_at": "2016-12-21T15:42:23.553Z",
"last_activity_at": "2016-12-21T15:42:23.553Z",
"shared_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 3,
"avatar_url": null,
"forks_count": 2,
"open_issues_count": 0,
"public_builds": true,
"shared_with_groups": [],
"only_allow_merge_if_build_succeeds": false,
"request_access_enabled": true,
"deadline": "2015-11-10T23:59:59.000Z",
"days_left": -408,
"class_name": "Meow-2016",
"item_type": "assignment"
}
]
}
Sample url:
http://175.186.199.226:10010/api/v1/classes/8/assignments
Output:
{
"role": "teacher",
"assignments": [
{
"id": 5,
"description": "d-1",
"default_branch": "master",
"ssh_url_to_repo": "[email protected]:Meow-2016/Meow-2016-test-1.git",
"http_url_to_repo": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1",
"name": "Meow-2016-test-1",
"name_with_namespace": "Meow-2016 / Meow-2016-test-1",
"container_registry_enabled": true,
"builds_enabled": true,
"created_at": "2016-12-21T15:42:23.553Z",
"last_activity_at": "2016-12-21T15:42:23.553Z",
"shared_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 3,
"avatar_url": null,
"forks_count": 2,
"open_issues_count": 0,
"public_builds": true,
"shared_with_groups": [],
"only_allow_merge_if_build_succeeds": false,
"request_access_enabled": true,
"deadline": "2015-11-10T23:59:59.000Z",
"days_left": -408,
"class_name": "Meow-2016",
"item_type": "assignment",
"forked": true
}
]
}
Sample url:
http://175.186.199.226:10010/api/v1/classes/8/assignments
Request Body:
{
"name": "test-1",
"description": "d-1",
"deadline":"2015-11-10T23:59:59Z"
}
Output:
true
Yes, just "true", nothing else
Sample url:
http://175.186.199.226:10010/api/v1/classes/8/assignments/fork/5
If it's already forked, or error occurred:
true
Yes, just "true", nothing else
If success:
{
"id": 13,
"description": "d-1 %ddl:2015-11-10T23:59:59Z%",
"default_branch": null,
"tag_list": [],
"public": false,
"archived": false,
"visibility_level": 0,
"ssh_url_to_repo": "[email protected]:xiaotonggao/Meow-2016-test-1.git",
"http_url_to_repo": "http://git.htcnet.moe/xiaotonggao/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/xiaotonggao/Meow-2016-test-1",
"owner": {
"name": "Xiaotong Gao",
"username": "xiaotonggao",
"id": 3,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/989caadbf7778dd7d3a3f093f779fc98?s=80&d=identicon",
"web_url": "http://git.htcnet.moe/xiaotonggao"
},
"name": "Meow-2016-test-1",
"name_with_namespace": "Xiaotong Gao / Meow-2016-test-1",
"path": "Meow-2016-test-1",
"path_with_namespace": "xiaotonggao/Meow-2016-test-1",
"container_registry_enabled": true,
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"builds_enabled": true,
"snippets_enabled": true,
"created_at": "2016-12-22T13:59:56.084Z",
"last_activity_at": "2016-12-22T13:59:56.084Z",
"shared_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 3,
"namespace": {
"id": 3,
"name": "xiaotonggao",
"path": "xiaotonggao",
"owner_id": 3,
"created_at": "2016-12-20T09:19:42.058Z",
"updated_at": "2016-12-20T09:19:42.058Z",
"description": "",
"avatar": null,
"share_with_group_lock": false,
"visibility_level": 20,
"request_access_enabled": true,
"deleted_at": null,
"lfs_enabled": null
},
"forked_from_project": {
"id": 5,
"http_url_to_repo": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1",
"name": "Meow-2016-test-1",
"name_with_namespace": "Meow-2016 / Meow-2016-test-1",
"path": "Meow-2016-test-1",
"path_with_namespace": "Meow-2016/Meow-2016-test-1"
},
"avatar_url": null,
"star_count": 0,
"forks_count": 0,
"open_issues_count": 0,
"runners_token": "7MT9LV65vjqW1eyzCNWz",
"public_builds": true,
"shared_with_groups": [],
"only_allow_merge_if_build_succeeds": false,
"request_access_enabled": true
}
Sample url:
http://175.186.199.226:10010/api/v1/classes/8/members
Output:
[
{
"name": "Houzi Tong",
"username": "houzitong",
"id": 6,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/735d3963f84ef93597614af34ab9e059?s=80&d=identicon",
"web_url": "http://git.htcnet.moe/houzitong",
"expires_at": "2017-03-09",
"role": "student",
"item_type": "member"
},
{
"name": "Jinkai Gao",
"username": "jinkaigao",
"id": 4,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/da5ffcbe7e31b4a0d334f51afc49d956?s=80&d=identicon",
"web_url": "http://git.htcnet.moe/jinkaigao",
"expires_at": "2017-03-09",
"role": "student",
"item_type": "member"
},
{
"name": "Fengshuang Li",
"username": "fengshuangli",
"id": 5,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/83a6fba412afad029840f2df3e46f634?s=80&d=identicon",
"web_url": "http://git.htcnet.moe/fengshuangli",
"expires_at": "2017-03-09",
"role": "student",
"item_type": "member"
},
{
"name": "Xiaotong Gao",
"username": "xiaotonggao",
"id": 3,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/989caadbf7778dd7d3a3f093f779fc98?s=80&d=identicon",
"web_url": "http://git.htcnet.moe/xiaotonggao",
"expires_at": null,
"role": "teacher",
"item_type": "member"
}
]
Sample url:
http://172.27.33.130:10010/api/v1/assignments
Output:
[
{
"id": 14,
"description": "d-1",
"default_branch": "master",
"ssh_url_to_repo": "[email protected]:fengshuangli/Meow-2016-test-1.git",
"http_url_to_repo": "http://git.htcnet.moe/fengshuangli/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/fengshuangli/Meow-2016-test-1",
"name": "Meow-2016-test-1",
"name_with_namespace": "Fengshuang Li / Meow-2016-test-1",
"container_registry_enabled": true,
"builds_enabled": true,
"created_at": "2016-12-22T15:17:28.775Z",
"last_activity_at": "2016-12-22T15:17:28.775Z",
"shared_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 5,
"forked_from_project": {
"id": 5,
"http_url_to_repo": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1.git",
"web_url": "http://git.htcnet.moe/Meow-2016/Meow-2016-test-1",
"name": "Meow-2016-test-1",
"name_with_namespace": "Meow-2016 / Meow-2016-test-1"
},
"avatar_url": null,
"forks_count": 0,
"open_issues_count": 0,
"public_builds": true,
"shared_with_groups": [],
"only_allow_merge_if_build_succeeds": false,
"request_access_enabled": true,
"permissions": {
"project_access": {
"access_level": 40,
"notification_level": 3
},
"group_access": null
},
"deadline": "2015-11-10T23:59:59.000Z",
"days_left": -408,
"class_name": "Meow-2016",
"item_type": "assignment"
}
]
Just like GET /assignments, return an object instead of an array.