FORMAT: 1A HOST: http://localhost
For MUCH better reading experience, please read the document at theyelda.docs.apiary.io.
TheYelda is a simple API for a medical images viewing system.
The Yelda API uses OAuth Authorization. First you create a new (or acquire existing) OAuth token using Basic Authentication(Username and Password). After you have acquired your token you can use it to access other resources within token' scope.
Where applicable this API uses the HAL+JSON media-type to represent resources states and affordances.
Requests with a message-body are using plain JSON to set or update resource states.
The common HTTP Response Status Codes are used.
TheYelda API entry point.
This resource does not have any attributes. Instead it offers the initial API affordances in the form of the HTTP Link header and HAL links.
-
Response 200 (application/hal+json)
-
Headers
Link: <http://api.theyelda.org/>;rel="self",<http:/api.theyelda.org/authorization>;rel="authorization",<http:/api.theyelda.org/accounts>;rel="accounts"
-
Body
{ "message": "", "_links": { "self": { "href": "/" }, "accounts": { "href": "/accounts/{?id}"}, "authorization": { "href": "/authorization"} } }
-
-
Response 400
-
Body
{ "message": "请求非法" }
-
Access and Control of The Yelda API OAuth token.
Authorization Resource represents an authorization granted to the user. You can only access your own authorization, and only through Username and Password.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "username": "yelda", "password": "yeldapass" }
-
-
Response 201
-
Body
{ "message": "登录成功", "account_id": 123, "authority": 101 }
-
-
Response 401
-
Body
{ "message": "用户不存在" }
-
-
Response 401
-
Body
{ "message": "密码错误" }
-
-
Response 401
-
Body
{ "message": "用户审核未通过" }
-
-
Request
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 204
{ "message": "登出成功" }
-
Response 401
{ "message": "用户未登录" }
Myself-related resources of The Yelda API.
A single account object. The account resource has the following attributes:
- id
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "ID获取成功", "account_id": 123 }
-
-
Response 401
{ "message": "用户未登录" }
Account-related resources of The Yelda API.
A single account object. The account resource has the following attributes:
- account_id
- username
- nickname
- password
- photo
- authority
The id is assigned by the server at the moment of creation.
- Parameters
- account_id: 123 (required, int) - ID of the Account in form of an integer
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户获取成功", "account_id": 364, "username": "yelda", "nickname": "Nick", "email": "yelda@mail.com", "photo": "photo1.png", "authority": 101 }
-
-
Response 401
{ "message": "用户无法访问他人账号" }
-
Response 404
{ "message": "用户不存在" }
To update an account, send a JSON with updated value for All of the account resource attributes EXCEPT id.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "nickname": "Nick", "password": "mypass", "email": "yelda@mail.com", "photo": "photo1.png", "authority": 102 }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户修改成功", "username": "yelda", "nickname": "Nick", "email": "yelda@mail.com", "photo": "photo2.png", "authority": 102 }
-
-
Response 401
{ "message": "用户无法修改他人信息" }
-
Response 401
{ "message": "用户无法修改权限" }
-
Response 401
{ "message": "管理员无法修改本账号权限" }
-
Response 401
{ "message": "管理员无法修改他人权限为管理员" }
-
Response 404
{ "message": "用户不存在" }
-
Response 204
-
Body
{ }
-
-
Response 401
{ "message": "用户无法删除他人账号" }
-
Response 401
{ "message": "管理员不可删除" }
-
Response 404
{ "message": "用户不存在" }
Collection of all accounts.
- Parameters
- username: yelda (optional, string) - Name of the Account in form of a string
- authority: 100 (optional, int) - Authority of the Account in form of an integer
- offset: 100 (optional, int) - record offset of all, counting from 0
- limit: 20 (optional, int) - maximum number of records of each page
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户集合获取成功", "data": [ { "account_id": 12, "username": "yelda", "nickname": "Nick", "email": "yelda@mail.com", "photo": "photo1.png", "authority": 102 }, { "account_id": 23, "username": "yelda2", "nickname": "Nick2", "email": "yelda2@mail.com", "photo": "photo2.png", "authority": 102 }, { "account_id": 34, "username": "yelda3", "nickname": "Nick2", "email": "yelda3@mail.com", "photo": "photo3.png", "authority": 102 } ] }
-
-
Response 401
{ "message": "用户无法查看他人账号" }
To create a new account simply provide a JSON. This action requires an authority
of admin
.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "username": "yelda100", "nickname": "Nick", "password": "yeldapass100", "email": "yelda100@mail.com" }
-
-
Response 201
-
Headers
Location: /accounts/100
-
Body
{ "message": "用户创建成功" }
-
-
Response 409
{ "message": "用户名已存在" }
Performance of a single Account
The id is assigned by the server at the moment of creation.
- Parameters
- account_id: 123 (required, int) - ID of the Account in form of an integer
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "获取成功", "data": { "progress": { "total_jobs": 100, "unlabeled_jobs": 20, "labeling_jobs": 30, "finished_jobs": 50 }, "quality: { "accuracy": 0.80 }, "dr": { "accuracy": 0.80 }, "stage": { "accuracy": 0.80 }, "dme": { "accuracy": 0.80 }, "hr": { "accuracy": 0.80 }, "age_dme: { "accuracy": 0.80 }, "rvo": { "accuracy": 0.80 }, "crao": { "accuracy": 0.80 }, "myopia": { "accuracy": 0.80 }, "od": { "accuracy": 0.80 }, "glaucoma": { "accuracy": 0.80 }, "others": { "accuracy": 0.80 } } }
-
-
Response 401
{ "message": "无法获得该用户工作统计量" }
-
Response 404
{ "message": "用户不存在" }
Job-related resources of The Yelda API.
A single job object. The job resource has the following attributes:
- job_id
- image_id
- account_id
- label_id
- job_state
- finished_date
The id is assigned by the server at the moment of creation.
- Parameters
- job_id: 253 (required, int) - ID of the Job in form of an integer
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "", "job_id": 132, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" }
-
-
Response 404
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "任务不存在" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户无法访问他人任务" }
-
To update a job, send a JSON with updated value for All of the job resource attributes EXCEPT id.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "label_id": 88, "job_state": 204 }
-
-
Response 200
-
Headers
Location: /jobs/1
-
Body
{ "message": "任务修改成功", "job_id": 132, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "用户无法修改他人任务" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "用户无法修改已完成的任务" }
-
-
Response 400
-
Headers
Location: /jobs/1
-
Body
{ "message": "指定的用户或图像不存在" }
-
-
Response 204
-
Headers
Location: /jobs/1
-
Body
{ }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "删除任务需要管理员权限" }
-
-
Response 404
-
Headers
Location: /jobs/1
-
Body
{ "message": "任务不存在" }
-
Collection of all jobs.
- Parameters
- job_state: 202 (optional, int) - job state filter
- image_id: 1 (optional, int) - image filter
- account_id: 1 (optional, int) - account filter
- offset: 100 (optional, int) - record offset of all, counting from 0
- limit: 20 (optional, int) - maximum number of records of each page
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message":"任务集合获取成功", "total": 10, "data": [ { "nickname": "nick", "job_id": 132, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" }, { "nickname": "nick", "job_id": 1234, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" }, { "nickname": "nick", "job_id": 352, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" } ] }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message":"用户未登录" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message":"用户没有权限访问其他用户的任务列表" }
-
To create a new job simply with a JSON. This action requires an authority
of admin
.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "image_id": 42, "account_id": 253 }
-
-
Response 201
-
Headers
Location: /jobs/1
-
Body
{ "message": "任务创建成功", "job_id": 132, "image_id": 427, "account_id": 42, "label_id": 88, "job_state": 200, "finished_date": "2018-04-17" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /jobs/1
-
Body
{ "message": "创建任务需要管理员权限" }
-
-
Response 400
-
Headers
Location: /jobs/1
-
Body
{ "message": "指定的用户或图像不存在" }
-
Image-related resources of The Yelda API.
A single image object. The image resource has the following attributes:
- image_id
- label_id
- image_state
- filename
- url
- source
The id is assigned by the server at the moment of creation.
- Parameters
- image_id: 123 (required, int) - ID of the Image in form of an integer
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "图像获取成功", "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户未登录" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "图像不存在" }
-
To update an image, send a JSON with updated value for All of the image resource attributes EXCEPT id.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "label_id": 67, "image_state": 300, "source": "somexxx" }
-
-
Response 200
-
Headers
Location: /images/1
-
Body
{ "message": "图像信息修改成功", "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "somexxx" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "修改图像信息需要管理员权限" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "图像不存在" }
-
-
Response 204
-
Headers
Location: /images/1
-
Body
{ "message": "已删除图像" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "删除图像需要管理员权限" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "图像不存在" }
-
Collection of all images.
- Parameters
- image_state: 301 (optional, int) - state of the image in form of a constant integer code
- offset: 100 (optional, int) - record offset of all, counting from 0
- limit: 20 (optional, int) - maximum number of records of each page
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message":"图像集合获取成功", "total": 10, "data": [ { "image_id": 432, "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" }, { "image_id": 332, "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" }, { "image_id": 542, "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" } ] }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
To create a new image simply with a JSON. This action requires an authority
of admin
.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "filename": "image1.png", "url": "hashcode", "source": "someone" }
-
-
Response 201
-
Headers
Location: /images/1
-
Body
{ "message": "图像创建成功", "image_id": 432, "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "创建图片需要管理员权限" }
-
Label-related resources of The Yelda API.
A single label object. The label resource has the following attributes:
- label_id
- quality
- dr
- stage
- dme
- hr
- agedme
- rvo
- crao
- myopia
- od
- glaucoma
- others
- comment
The id is assigned by the server at the moment of creation.
- Parameters
- label_id: 123 (required, int) - ID of the Label in form of an integer
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "标注获取成功", "quality": [701, 702, 703], "dr": false, "stage": 0, "dme": 400, "hr": 500, "age_dme": 600, "rvo": false, "crao": true, "myopia": false, "od": true, "glaucoma": false, "others": true, "comment": "COMMENT" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户无法访问其他用户的标注信息" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "标注不存在" }
-
To update a label, send a JSON with updated value for All of the label resource attributes EXCEPT id.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "quality": [701, 702, 703], "dr": false, "stage": 702, "dme": 400, "hr": 500, "age_dme": 600, "rvo": 902, "crao": 1003, "myopia": false, "od": true, "glaucoma": false, "others": true, "comment": "COMMENT" }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "标注修改成功", "quality": [701, 702, 703], "dr": false, "stage": 702, "dme": 400, "hr": 500, "age_dme": 600, "rvo": 902, "crao": 1003, "myopia": false, "od": true, "glaucoma": false, "others": true, "comment": "COMMENT" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户无法修改其他用户的标注信息" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户无法修改该标注信息" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "标注不存在" }
-
-
Response 204
-
Headers
Location: /images/1
-
Body
{ "message": "已删除标注信息" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户无法删除其他用户的标注" }
-
-
Response 404
-
Headers
Location: /images/1
-
Body
{ "message": "标注不存在" }
-
Collection of all labels.
To create a new image simply with a JSON. This action requires an authority
of admin
.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ "quality": [701, 702, 703], "dr": false, "stage": 702, "dme": 400, "hr": 500, "age_dme": 600, "rvo": 902, "crao": 1003, "myopia": false, "od": true, "glaucoma": false, "others": true, "comment": "COMMENT" }
-
-
Response 201
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "标注创建成功", "label_id": 634, "quality": [701, 702, 703], "dr": false, "stage": 702, "dme": 400, "hr": 500, "age_dme": 600, "rvo": 902, "crao": 1003, "myopia": false, "od": true, "glaucoma": false, "others": true, "comment": "COMMENT" }
-
-
Response 401
-
Headers
Location: /images/1
-
Body
{ "message": "用户未登录" }
-
Upload photo related resources of The Yelda API.
A single photo object. A photo is a binary files
The filename is a full name with filename extension like "yelda.jpg".
For example, maybe you can use the label like
<img src="http://ourhost:8080/api/uploads/photos/admin.jpg" />
to get the photo file
- Parameters
- filename: abc.png (required, string) - Name of the file in form of a string
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Body
raw data
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户未登录" }
-
To upload a new photo. This action is login-required
.
-
Request (application/json)
-
Headers
-
Body
{ raw_data }
-
-
Response 201
-
Headers
-
Body
{ "message": "头像上传成功" }
-
-
Response 400
-
Headers
-
Body
{ "message": "头像上传失败" }
-
Upload medical image related resources of The Yelda API.
A single medical image object.
- Parameters
- url: 20180620154353.262116-4139340812150045587.png (required, string) - Hash value of the filename and timestamp in form of a string
- green_channel: true (optional) - A flag indicating to get green-channel grey scale image
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Body
raw data
-
-
Response 401
-
Headers
Last-Modified: 2018-04-17
-
Body
{ "message": "用户未登录" }
-
To upload a new medicalimage. This action is login-required
.
-
Request (application/json)
-
Headers
-
Body
{ raw_data }
-
-
Response 201
-
Headers
-
Body
{ "message": "医学影像上传成功" "image_id": 432, "label_id": 67, "image_state": 300, "filename": "image1.png", "url": "hashcode", "source": "someone" }
-
-
Response 400
-
Headers
-
Body
{ "message": "医学影像上传失败" }
-
Download-related resources of The Yelda API.
Download personal labels by account_id
, or all labels without account_id
given
- Parameters
- account_id: 123 (optional, int) - ID of the Account in form of an integer.
-
Request (application/json)
-
Headers
Accept: application/json
-
Body
{ }
-
-
Response 200
-
Headers
Last-Modified: 2018-04-17
-
Body
{ raw data }
-
-
Response 403
{ "message": "只有管理员有下载权限" }
-
Response 404
{ "message": "用户不存在" }