-
Notifications
You must be signed in to change notification settings - Fork 38
Open hackathon Restful API
Welcome to the Open Hackathon Platform Restful API!
- 调用说明
-
Hackathon APIs
- Manage Hackathon: /api/hackathon
- List Hackathon: /api/hackathon/list
- Query Hackathon statistics: /api/hackathon/stat
- User Registeration info on a Hackathon: /api/user/hackathon
- List registered hackathons of a user: /api/user/hackathon/list
- List hackathons with admin access: /api/admin/hackathon/list
- Check whether a subscription id is valid
- Check name availability: /api/hackathon/checkname
- List all admins of a hackathon
- Add an admin to a hackathon
- Update an admin of a hackathon
- Delete an admin of a hackathon
- /api/admin/hackathon
- /api/admin/hackathon/config
- Create an organizer to a hackathon
- Update an organizer of a hackathon
- Delete an organizer of a hackathon
- Get awards' setting list of a hackathon
- Create an award to a hackathon
- Update an award of a hackathon
- Delete an award of a hackathon
- Get teams list of a hackathon
- Add a host server for docker
- Update docker host server
- Query and check docker host server
- Delete docker host server
- List all host servers
- List notices
- /api/admin/hackathon/notice
- User APIs
- Experiment APIs
- Template APIs
- Other APIs
- Seek for Help
Open Hackathon API均为RESTFul API, 输入(post/put)和输出均为json格式。几点重要说明:
- Endpoint Base: http://hacking.kaiyuanshe.cn:15000/
-
tokenheader: 需要用户身份票据的接口,即要求用户已登录(比如登出或者报名),这类接口需要再Header里传入token,其值和有效期通过登录接口可以获取.如果接口(比如运行状态检查接口/health和活动批量查询接口/api/hackathon/list)不需要用户信息,那么无需传入token. -
hackathon_name: 活动名称对于开放黑客松平台来说是很重要的一个参数,所以它获得了和token类似的待遇。凡事涉及某个hackathon的时候,比如查询某个hackathon的详情,比如报名某次hackathon,都需要在Header里传入hackathon_name, 其值可通过hackathon列表查询接口获取。同token类似,该字段非必需。 - 服务器只会返回HTTP code 200。即使出错,不管是服务器错误(比如500异常)或者客户端错误(404,401等),返回的HTTP状态码依然是200,但同时会在HTTP body里面,以JSON格式返回真实状态码,比如:
{
"error": {
"message": "hackathon name invalid",
"code": 400,
"friendly_message": "The browser (or proxy) sent a request that this server could not understand."
}
}api url : /api/hackathon
| Method | Description | Requirement |
|---|---|---|
| Get | get the hackathon info | hackathon_name in headers |
| POST | creat a new hackathon | token in headers,json data in body |
| PUT | modify a exist hackathon | token and hackathon both in headers,json data in body |
| Reponse |
Get method :
Put Method:
POST Method:
api url :/api/hackathon/list
| Method | Description | Required |
|---|---|---|
| GET | get hackathon list | user_id and status are optional in args |
| function: |
if user_id in args : return all hactahons
if user_id not in args : to get all hackathons and registration info
status is a filter to get hackathos
Reponse
[{
"archive_time": null,
"basic_info": {
"auto_approve": false,
"banners": "https://hackathon.blob.core.chinacloudapi.cn/images/ASADA/52f832fe-20150519153320.jpg",
"location": "asasdsad",
"max_enrollment": "1",
"organizer_description": "",
"organizer_image": "",
"organizer_name": "",
"organizer_url": "",
"organizers": [{
"organizer_description": "asasdsadad",
"organizer_image": "https://www.google.com/images/srpr/logo11w.png",
"organizer_name": "ASDSAD",
"organizer_url": "http://google.com"
}],
"pre_allocate_enabled": false,
"pre_allocate_number": 1,
"recycle_enabled": false,
"wall_time": ""
},
"create_time": 1430789602000,
"creator_id": null,
"description": "test2-description",
"display_name": "test2-display_name",
"event_end_time": null,
"event_start_time": null,
"extra_info": {},
"id": 9,
"judge_end_time": null,
"judge_start_time": null,
"name": "test2-hackathon",
"registration": {
"address": null,
"age": null,
"career": null,
"career_type": null,
"create_time": 1432253040000,
"deleted": 0,
"description": null,
"email": null,
"gender": null,
"hackathon_id": 9,
"id": 4,
"phone": null,
"qq": null,
"real_name": "test_4",
"skype": null,
"status": null,
"team_name": "test_team_4",
"update_time": null,
"user_id": 8,
"wechat": null,
"weibo": null
},
"registration_end_time": null,
"registration_start_time": null,
"status": 2,
"update_time": 1430789632000
},{
"archive_time": null,
"basic_info": {},
"create_time": 1432028935000,
"creator_id": 3,
"description": null,
"display_name": "dsadsfsfasda",
"event_end_time": null,
"event_start_time": null,
"extra_info": {},
"id": 43,
"judge_end_time": null,
"judge_start_time": null,
"name": "adsasdasdasd",
"registration": {
"address": null,
"age": null,
"career": null,
"career_type": null,
"create_time": 1432253040000,
"deleted": 0,
"description": null,
"email": null,
"gender": null,
"hackathon_id": 9,
"id": 4,
"phone": null,
"qq": null,
"real_name": "test_4",
"skype": null,
"status": null,
"team_name": "test_team_4",
"update_time": null,
"user_id": 8,
"wechat": null,
"weibo": null
},
"registration_end_time": null,
"registration_start_time": null,
"status": 0,
"update_time": 1432028935000
}]api url : /api/hackathon/stat
| Method | Description | Required |
|---|---|---|
| GET | get the real-time hackathon user info | hackathon_name in headers |
| Reponse: |
{
"hid": 9,
"offline": 0,
"online": 0,
"total": 0
}api url : /api/user/hackathon
| Method | Description | Required |
|---|---|---|
| GET | get details after user login, contains registration experiment and hackathon info | token and hackathon_name are both in headers |
| POST | user registers to a hackathon | token and hackathon_name are both in headers |
api url: /api/user/hackathon/list
| Method | Description | Required |
|---|---|---|
| GET | get details after user login, contains a list of registration experiment and hackathon info | token required in headers |
POST /api/admin/azure/checksubid
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| subscription_id | string | body | yes | subscription id used to access azure |
{
"error": {
"message": "Subscription id is not valid, check whether subscription id is valid and upload the right cer file to azure",
"code": 400,
"friendly_message": "The browser (or proxy) sent a request that this server could not understand."
}
} GET /api/admin/hackathon/administrator/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | header | Yes | hackathon_name |
[
{
"assets": {},
"create_time": 1458095525141,
"deleted": false,
"hackathon": "56e8c5eef9a2f30d9117e0fa",
"id": "56e8c5eef9a2f30d9117e0fb",
"like": true,
"remarks": "creator",
"role": 1,
"status": 3,
"update_time": 1458095525141,
"user": "56e677a8b5f5e70ad5aabdf1",
"user_info": {
"create_time": 1457944487732,
"emails": [],
"id": "56e677a8b5f5e70ad5aabdf1",
"is_super": true,
"login_times": 14,
"name": "admin",
"nickname": "admin",
"online": false,
"update_time": 1457944487732
}
}
] POST /api/admin/hackathon/administrator
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Yes | object_id of the user |
| role | int | body | Yes |
1admin, 2judge |
| remark | string | body | Yes | remark |
{
"code": 200,
"message": ""
} PUT /api/admin/hackathon/administrator
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Yes | object_id of user_hackathon |
| role | int | body | No |
1admin, 2judge |
| remark | string | body | No | remark |
{
"code": 200,
"message": "update hackathon admin successfully"
} DELETE /api/admin/hackathon/administrator
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Yes | object_id of user_hackathon |
{
"code": 200,
"message": ""
} api url: /api/admin/hackathon
| Method | Description | Required |
|---|---|---|
| GET | get details of a hackathon | hackathon_name in header |
| POST | create a new hackathon | token in header, json data(hackathon information) in body scope |
| PUT | update details of a hackathon | token and hackathon_name both in header, json data(hackathon information) in body scope |
GET /api/admin/hackathon
POST /api/admin/hackathon
{
"awards": [],
"azure_keys": [],
"banners": [],
"config": {},
"create_time": 1458095525141,
"creator": "56e677a8b5f5e70ad5aabdf1",
"description": "<p>xiangqing</p>",
"display_name": "test1",
"event_end_time": 1480291200000,
"event_start_time": 1456790400000,
"id": "56e8c5eef9a2f30d9117e0fa",
"judge_end_time": 1482969600000,
"judge_start_time": 1456790400000,
"name": "test1",
"organizers": [],
"partners": [],
"registration_end_time": 1480291200000,
"registration_start_time": 1456790400000,
"ribbon": "guanggao",
"short_description": "jianjie",
"stat": {
"register": 5
},
"status": 1,
"tags": [],
"templates": [],
"type": 1,
"update_time": 1458717371334,
"user": {
"create_time": 1457944487732,
"emails": [],
"id": "56e677a8b5f5e70ad5aabdf1",
"is_admin": true,
"is_super": true,
"login_times": 14,
"name": "admin",
"nickname": "admin",
"online": false,
"update_time": 1457944487732
}
} PUT /api/admin/hackathon
{
"code": 200,
"message": ""
}
api url: /api/admin/hackathon/config
| Method | Description | Required |
|---|---|---|
| GET | get all configurations of a hackathon | hackathon_name in header |
| POST | update part of configurations of a hackathon | token hackathon_name both in header, json dict (property names and their new values) in body |
| PUT | update part of configurations of a hackathon | the same as POST |
| DELETE | delete part of configurations of a hackathon | token and hackathon_name both in header, json list (property names(type: str) to be deleted) in query |
GET /api/admin/hackathon/config
{
"pre_allocate_number" : 1,
"freedom_team" : false,
"login_provider" : 16,
"pre_allocate_enabled" : false,
"recycle_enabled" : false,
"max_enrollment" : 100,
"cloud_provide" : "2",
"recycle_minutes" : 0,
"auto_approve" : true
}
POST /api/admin/hackathon/config
PUT /api/admin/hackathon/config
DELETE /api/admin/hackathon/config
{
"code": 200,
"message": ""
}
POST /api/admin/hackathon/organizer
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| name | string | body | Yes | name of organizer |
| description | string | body | Yes | description |
| homepage | string | body | Yes | homepage |
| logo | string | body | Yes | logo |
| organization_type | int | body | Yes |
1organization, 2partner |
{
"code": 200,
"message": ""
} PUT /api/admin/hackathon/organizer
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Yes | uuid of organization (see class Organization in hmongo) |
| name | string | body | No | name of organizer |
| description | string | body | No | description |
| homepage | string | body | No | homepage |
| logo | string | body | No | logo |
| organization_type | int | body | No |
1organization, 2partner |
{
"code": 200,
"message": ""
} DELETE /api/admin/hackathon/organizer
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Yes | uuid of organization (see class Organization in hmongo) |
{
"code": 200,
"message": ""
} GET /api/admin/hackathon/award/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | header | Yes | hackathon_name |
[
{
"award_url": "http://test.award",
"description": "award1",
"id": "496f1cd8-2330-4edd-81cb-94cfa70b764b",
"level": 10,
"name": "testaward1",
"quota": 1
},
{
"award_url": "http://test.award",
"description": "award1",
"id": "9a2ca217-e777-49a8-afd8-a3eaa50ac0a4",
"level": 7,
"name": "testaward1",
"quota": 7
},
{
"award_url": "http://test.award",
"description": "award1",
"id": "1f517a2d-39b6-40d0-a189-11106cc1ee39",
"level": 1,
"name": "testaward1",
"quota": 1
}
] POST /api/admin/hackathon/award
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| name | string | body | Yes | name of award |
| description | string | body | Yes | description |
| level | int | body | Yes |
1 to 10
|
| quota | int | body | Yes | quota |
| award_url | string | body | Yes | award_url |
{
"code": 200,
"message": ""
} PUT /api/admin/hackathon/award
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Yes | uuid of award |
| name | string | body | No | name of organizer |
| description | string | body | No | description |
| level | int | body | No |
1 to 10
|
| quota | int | body | No | quota |
| award_url | string | body | No | award_url |
{
"code": 200,
"message": ""
} DELETE /api/admin/hackathon/award
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Yes | uuid of award |
{
"code": 200,
"message": ""
} GET /api/admin/team/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | header | Yes | hackathon_name |
[
{
"assets": {},
"awards": [],
"create_time": 1458870016024,
"hackathon": "56e8c5eef9a2f30d9117e0fa",
"id": "56f49a68f9a2f34bc620283b",
"is_admin": true,
"is_frozen": true,
"is_leader": false,
"is_member": false,
"leader": {
"avatar_url": "http://q.qlogo.cn...",
"create_time": 1458525394935,
"emails": [],
"id": "56ef556ef9a2f32cb2224f9d",
"is_super": false,
"login_times": 1,
"name": "\uffe1\u98db\u8e8d\u3005",
"nickname": "\uffe1\u98db\u8e8d\u3005",
"online": true,
"openid": "2AB1FFEBCB0E5C415AF4D15A199BD9E6",
"provider": "qq",
"update_time": 1458525394935
},
"logo": "http://q.qlogo.cn/qqapp/...",
"member_count": 1,
"members": [
{
"join_time": 1458870888852,
"status": 1,
"user": "56ef556ef9a2f32cb2224f9d"
}
],
"name": "\uffe1\u98db\u8e8d\u3005",
"scores": [],
"templates": [],
"update_time": 1458870016024,
"works": []
}
]POST /api/admin/hostserver
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| vm_name | string | body | Required | name of VM,should be consistent of the VM name on azure. |
| public_ip | string | body | Required | public IP |
| private_ip | string | body | Optional | private IP |
| public_dns | string | body | Required | public dns name of VM. Should be consistent with azure cloud service |
| container_max_count | int | body | Required | maximum count of docker container on this VM |
| Parameter | Type | Description |
|---|---|---|
| id | string | unique id of the VM if created |
| state | int | state of VM. 2-ready 3-unavailable |
{
"container_count": 0,
"container_max_count": 100,
"create_time": 1459428938530,
"disabled": true,
"hackathon": "56fcd5dbd769d56d724f1ae9",
"id": "56fd1e4ad769d50664e10ee8",
"is_auto": false,
"private_docker_api_port": 4243,
"private_ip": "127.0.0.1",
"public_dns": "localhost",
"public_docker_api_port": 4243,
"public_ip": "127.0.0.1",
"state": 2,
"update_time": 1459428938530,
"vm_name": "localhost"
}PUT /api/admin/hostserver
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Required | the unique id of host server |
| Parameter | Type | Description |
|---|---|---|
| id | string | unique id of the VM if created |
| state | int | state of VM. 2-ready 3-unavailable |
{
"container_count": 0,
"container_max_count": 100,
"create_time": 1459428938530,
"disabled": true,
"hackathon": "56fcd5dbd769d56d724f1ae9",
"id": "56fd1e4ad769d50664e10ee8",
"is_auto": false,
"private_docker_api_port": 4243,
"private_ip": "127.0.0.1",
"public_dns": "localhost",
"public_docker_api_port": 4243,
"public_ip": "127.0.0.1",
"state": 2,
"update_time": 1459428938530,
"vm_name": "localhost"
}GET /api/admin/hostserver?id=:id
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Required | id of the VM |
| Parameter | Type | Description |
|---|---|---|
| id | string | unique id of the VM if created |
| state | int | state of VM. 2-ready 3-unavailable |
{
"container_count": 0,
"container_max_count": 100,
"create_time": 1459428938530,
"disabled": true,
"hackathon": "56fcd5dbd769d56d724f1ae9",
"id": "56fd1e4ad769d50664e10ee8",
"is_auto": false,
"private_docker_api_port": 4243,
"private_ip": "127.0.0.1",
"public_dns": "localhost",
"public_docker_api_port": 4243,
"public_ip": "127.0.0.1",
"state": 2,
"update_time": 1459428938530,
"vm_name": "localhost"
}DELETE /api/admin/hostserver?id=:id
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Required | unique id of the host server. |
GET /api/admin/hostserver/list
| Parameter | Type | Description |
|---|---|---|
| id | string | unique id of the VM if created |
| state | int | state of VM. 2-ready 3-unavailable |
[{
"container_count": 1,
"container_max_count": 100,
"create_time": 1459491589853,
"disabled": false,
"hackathon": "56fcd5dbd769d56d724f1ae9",
"id": "56fe1306d769d5348ae8cc70",
"is_auto": false,
"private_docker_api_port": 4243,
"private_ip": "10.212.124.27",
"public_dns": "docker-host.chinacloudapp.cn",
"public_docker_api_port": 4243,
"public_ip": "42.159.235.43",
"state": 2,
"update_time": 1459491589853,
"vm_name": "docker-host"
}, {
"container_count": 0,
"container_max_count": 100,
"create_time": 1459428938530,
"disabled": true,
"hackathon": "56fcd5dbd769d56d724f1ae9",
"id": "56fd1e4ad769d50664e10ee8",
"is_auto": false,
"private_docker_api_port": 4243,
"private_ip": "127.0.0.1",
"public_dns": "localhost",
"public_docker_api_port": 4243,
"public_ip": "127.0.0.1",
"state": 2,
"update_time": 1459428938530,
"vm_name": "localhost"
}]GET /api/hackathon/notice/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | query | No | return notices that only belongs to specified hackathon if this field exists, default unfiltered |
| filter_by_user | enum(unread, all) | query | No | return notices that only belongs to the login user(unread only lists unread notice, all lists all) if this field exists, default unfiltered |
| category | int[,int...] | query | No | return notices that belongs to specified categories, default unfiltered |
| event | int[,int...] | query | No | return notices that belongs to specified events, default unfiltered |
| order_by | enum(time, event, category) | query | No | return notices ordered by time or event or category, default by time |
| page | int | query | No | the number of pages, default 1 |
| per_page | int | query | No | number of items shown in each page, default 1000 |
{
"items": [
{
"category": 0,
"is_read": false,
"update_time": 1460654431084,
"id": "5716e275a78016443b647988",
"content": "\u60a8\u6709\u672a\u5b8c\u6210\u7684\u4efb\u52a1\uff0c\u8bf7\u63d0\u4ea4\u5f00\u53d1\u8bf4\u660e\u4e66",
"create_time": 1460654431084,
"link": "/site/azure-open-hackathon/team",
"hackathon": "570e210ca78016f268b0f66d",
"receiver": "5705f87ea78016769c67dd49",
"event": 6
}
],
"total": 1,
"page": 1,
"per_page": 1000
}token and hackathon_name are both required in header
GET/PUT/DELETE
| Method | Description | Required | Optional parameters |
|---|---|---|---|
| GET | get the notice detail of given id | id | None |
| PUT | update the notice detail of given id | id | content(notice content), link(notice link), category(notice category) |
| DELETE | delete the notice of given id | id | None |
POST
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | header | No | the hackathon name that the new notice belongs to, default not belong to any hackathon |
| content | string | query | Yes | the content of the new notice, default "", for some events default content can generate. |
| category | int | query | No | the category that the new notice belongs to, default category 0 |
| event | int | query | No | the event that the new notice belongs to, default event 0 |
| link | string | query | No | the link url of the new notice, default "" |
GET /api/admin/hackathon/notice
POST /api/admin/hackathon/notice
PUT /api/admin/hackathon/notice
{
"category": 0,
"is_read": false,
"update_time": 1460654431084,
"id": "5716e275a78016443b647988",
"content": "\u60a8\u6709\u672a\u5b8c\u6210\u7684\u4efb\u52a1\uff0c\u8bf7\u63d0\u4ea4\u5f00\u53d1\u8bf4\u660e\u4e66",
"create_time": 1460654431084,
"link": "/site/azure-open-hackathon/team",
"hackathon": "570e210ca78016f268b0f66d",
"receiver": "5705f87ea78016769c67dd49",
"event": 6
} DELETE /api/admin/hackathon/notice
{
"code": 200,
"message": ""
}api url : /api/user/login
| Method | Description | Required |
|---|---|---|
| POST | Login |
username and password in body for local user in DB. code and provider in body for oauth |
| DELETE | Logout |
token in Header |
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| username | string | body |
Yes for db, No for OAuth |
user name, required for local user |
| password | string | body |
Yes for db, No for OAuth |
password, required for local user |
| code | string | body |
Yes for OAuth, No for db
|
authorization code for OAuth login, required for OAuth login |
| provider | string | body | Yes | Login provider. Accepted values(lowercase only): db, github, qq, wechat, live, weibo. Values except db are considers as OAuth. |
{
"provider": "github"
"code": "b4bea6dcccc63ff8754a"
}
{
"provider": "db",
"username: "zhangsan",
"password": "<encrypted password>"
}
{
"token": {
"update_time": 1583586893749,
"issue_date": 1583586916932,
"token": "a11d446e-6095-11fb-0adf-fa163e15344c",
"create_time": 1583586893749,
"expire_date": 1583590516932,
"id": "5e639asdf92hjf4729b31234",
"user": "aaaafe7b99333d771e123456"
},
"user": {
"profile": {
"user_id": "aaaafe7b99333d771e123456",
"career_type": "计算机/互联网/通信",
"gender": -1,
"age": 20,
"real_name": "张三",
"phone": "13012345678",
"address": "China Shanghai"
},
"openid": "1234567",
"update_time": 1552744025606,
"is_super": false,
"last_login_time": 1583586541949,
"login_times": 10,
"access_token": "c352bd12345ee1j999ffabc33b7dba83j82al0ab",
"online": true,
"avatar_url": "https://avatars3.githubusercontent.com/u/1234567?v=4",
"id": "5e639asdf92hjf4729b31234",
"create_time": 1552744025606,
"provider": "github",
"nickname": "Zhang San",
"emails": [
{
"verified": true,
"email": "zhangsan@example.com",
"primary_email": true
},
{
"verified": true,
"email": "zhangsan@example2.com",
"primary_email": false
}
],
"name": "zhangsan"
}
}
api url : /api/user/<int:id>
| Method | Description | Required |
|---|---|---|
| GET | get the detail user info | None |
{
"avatar_url": null,
"create_time": "2015-05-04 06:26:31",
"email": [
{
"create_time": 1430720791000,
"email": "v-bih@microsoft.com",
"id": 1,
"name": "mshubian",
"primary_email": 1,
"update_time": 1430720791000,
"user_id": 2,
"verified": 1
}
],
"id": 2,
"last_login_time": "2015-05-04 06:26:31",
"name": "mshubian",
"nickname": "mshubian",
"online": 1
} GET /api/admin/user/list?keyword=<string:keyword>&page=<int:page>&per_page=<int:per_page>
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| keyword | string | query | No | keyword of user's name, nickname or emails |
| page | int | query | No | the number of pages |
| per_page | int | query | No | number of items shown in each page |
| Parameter | Type | Description |
|---|---|---|
| items | list | list of matched users |
{
"items": [
{
"create_time": 1457944487732,
"emails": [],
"id": "56e677a8b5f5e70ad5aabdf1",
"is_super": true,
"login_times": 14,
"name": "admin",
"nickname": "admin",
"online": false,
"remark": null,
"role": 1,
"update_time": 1457944487732
}
],
"page": 1,
"per_page": 20,
"total": 1
} GET /api/admin/registration/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| hackathon_name | string | header | Yes | hackathon_name |
[
{
"assets": [],
"create_time": 1458721344627,
"deleted": false,
"hackathon": "56e8c5eef9a2f30d9117e0fa",
"id": "56f25d70f9a2f3490b78eceb",
"like": true,
"remark": "test",
"role": 3,
"status": 3,
"update_time": 1458721344627,
"user": {
"avatar_url": "http://q.qlogo.cn/...",
"create_time": 1458525394935,
"emails": [],
"id": "56ef556ef9a2f32cb2224f9d",
"is_super": false,
"login_times": 1,
"name": "\uffe1\u98db\u8e8d\u3005",
"nickname": "\uffe1\u98db\u8e8d\u3005",
"online": true,
"openid": "2AB1FFEBCB0E5C415AF4D15A199BD9E6",
"provider": "qq",
"update_time": 1458525394935
}
}
] PUT /api/admin/registration
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | body | Yes | object_id of user_hackathon |
| status | int | body | Yes |
0unaudit, 1audit_pass, 2audit_refuse, 3auto_pass (see HACK_USER_STATUS) |
{
"assets": [],
"create_time": 1458721344627,
"deleted": false,
"hackathon": "56e8c5eef9a2f30d9117e0fa",
"id": "56f25d70f9a2f3490b78eceb",
"like": true,
"remark": "test",
"role": 3,
"status": 2,
"update_time": 1458724910507,
"user": "56ef556ef9a2f32cb2224f9d"
} DELETE /api/admin/registration
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | string | query | Yes | object_id of user_hackathon |
{
"code": 200,
"message": ""
} GET /api/user/experiment?id=<string:id>
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | ObjectId | query | Required | id of the experiment |
| Parameter | Type | Description |
|---|---|---|
| expr_id | OjbectId | unique id of the experiment |
| hackathon | ObjectId | unique id of the related hackathon |
| hackathon_name | string | name of the related hackathon |
| status | int | 0-init, 1-staring,2-running,others-error state |
| public_urls | list | list of url that are public accessible |
| remote_servers | list | list of remote servers for guacamole |
{
"create_time": "2016-03-25 02:59:22.170000",
"expr_id": "56f4a98ad769d514212dda36",
"hackathon": "56f3c6bfd769d52276b48cf2",
"hackathon_name": "test324",
"last_heart_beat_time": "None",
"public_urls": [
{
"name": "port",
"url": "http://cloudweek02.chinacloudapp.cn:10095/"
}
],
"remote_servers": [
{
"guacamole_host": "http://localhost:8080",
"name": "411-chanzhi-f3z06joo",
"url": "http://localhost:8080/guacamole/#/client/c/411-chanzhi-f3z06joo?name=411-chanzhi-f3z06joo"
}
],
"status": 2
} GET /api/template?id=<string:id>
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| id | ObjectId | query | Required | id of the template |
| Parameter | Type | Description |
|---|---|---|
| creator | OjbectId | creator of the template |
| provider | int |
0 for docker, 1 for Azure VM |
| url | string | public url for downloading |
{
"create_time": 1458634250243,
"creator": "56d7dfdaa4a852ee819d509e",
"description": "\u8749\u77e5\u4f01\u4e1a\u95e8\u6237\u7cfb\u7edf,\u4e13\u5411\u4f01\u4e1a\u8425\u9500\u4f7f\u7528\u7684\u4f01\u4e1a\u95e8\u6237\u7cfb\u7edf",
"id": "56f103bcd769d51028549c76",
"local_path": "/home/junbo/github/juniwang/open-hackathon/open-hackathon-server/src/hackathon/static/upload/template/20160322/chanzhi.js",
"name": "chanzhi",
"provider": 0,
"status": 0,
"update_time": 1458634250244,
"url": "http://localhost:15000/static/upload/template/20160322/chanzhi.js",
"virtual_environment_count": 1
}GET /api/template/list
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| name | string | query | optional | sub string of template name |
| description | string | query | optional | sub string of template description |
| status | int | query | optional | status of template |
| Parameter | Type | Description |
|---|---|---|
| creator | OjbectId | creator of the template |
| provider | int |
0 for docker, 1 for Azure VM |
| url | string | public url for downloading |
[
{
"create_time": 1458634250243,
"creator": "56d7dfdaa4a852ee819d509e",
"description": "\u8749\u77e5\u4f01\u4e1a\u95e8\u6237\u7cfb\u7edf,\u4e13\u5411\u4f01\u4e1a\u8425\u9500\u4f7f\u7528\u7684\u4f01\u4e1a\u95e8\u6237\u7cfb\u7edf",
"id": "56f103bcd769d51028549c76",
"local_path": "/home/junbo/github/juniwang/open-hackathon/open-hackathon-server/src/hackathon/static/upload/template/20160322/chanzhi.js",
"name": "chanzhi",
"provider": 0,
"status": 0,
"update_time": 1458634250244,
"url": "http://localhost:15000/static/upload/template/20160322/chanzhi.js",
"virtual_environment_count": 1
},
{
"create_time": 1458634250243,
"creator": "56d7dfdaa4a852ee819d509e",
"description": "All in one docker-based template for AMPCamp6",
"id": "56f103c2d769d51028549c77",
"local_path": "/home/junbo/github/juniwang/open-hackathon/open-hackathon-server/src/hackathon/static/upload/template/20160322/AMPCamp6.js",
"name": "AMPCamp6",
"provider": 0,
"status": 0,
"update_time": 1458634250244,
"url": "http://localhost:15000/static/upload/template/20160322/AMPCamp6.js",
"virtual_environment_count": 1
}
]GET / or GET /health
| Parameter | Type | Scope | Required | Description |
|---|---|---|---|---|
| q | string | query | Optional |
all or specific item such as guacamole. |
| Parameter | Type | Description |
|---|---|---|
| status | string |
ok,warningorerror
|
| start_time | date | time the Open hackathon server started at |
| report_time | date | time the report was generated |
| up | timespan | how long the OHP server keep running |
{
"status": "ok",
"report_time": "2016-03-22 07:33:19.865507",
"guacamole": {
"status": "ok"
},
"start_time": "2016-03-15 07:03:20.960192",
"storage": {
"status": "ok",
"description": "You can use Azure resources now."
},
"up": "7 days 0 hours 29 minutes",
"mysql": {
"status": "ok",
"version": "1.0.8"
}
}GET /api/currenttime
{
"currenttime": 1458634431592
}Any question, please log issue on Issue Tracker or Contact Us