/**
* ========== HTTP API ==========
* *tokenAuth* : in request header
* authorization: <user's token here>
*
* ALL POST,PUT requests SHOULD put its params in body section
* with 'application/json' content-type
* ALL GET requests SHOULD put its params in query string
*
* ALL requests that the server resolves correctly MUST have json
* type response below. Called 'ok struct'
* { ok: Boolean,
* data: {......} // if ok is true
* error: { code: <option>, message: String } // if ok is false
* }
*
* Bulk requests [<request payload 1>,<request payload 2>,....<request payload n>]
* will be reponsed like [<ok struct 1>, <ok struct 2>,.....<ok struct n>]
*
* NOTES:
* 401: endpoints required tokenAuth but request's token is invalid
* 400: lack of necessary params
* ==============================
*/
LINKS COLLECTION
GET /v1/linksColl/:id
request
response
linksColl with all its items
GET /v1/linksColl/own
return all linksColls that the current user has created
request
- perCollItemLimit
0 -> return all items
n -> n items
undefined -> only return metas (default)
response
GET /v1/linksColl/watch
return all linksColls that the current user watches
request
- perCollLimit
- itemUpdatedAfter like a small notif red point
reponse
GET /v1/linksColl/query
requests
- title,description,tag,category fuzz search
- readers,watchers,collaborators =
user's _id
- author =
user's _id
- updatedAter =
time
- perCollItemLimit
- sortBy = |title,description,tag,category| updatedTime createdTime hot
- limit
- page
response
POST /v1/linksColl
create a linksColl without items
requests
- title (required) ,description,tags(array),category (required)
- readers,watchers,collaborators (default:
creator)
response
PUT /v1/linksColl
create a linksColl without items
requests
- _id (required)
- title,description,category
response
DELETE /v1/linksColl (not possible)
POST/DELETE /v1/linksColl/:id/tags/(:tagName)
modify tags
GET/POST/PUT/DELETE /v1/linksColl/:id/[readRequests,readers,watchers,collaborators]/(:id)
LINKS COLLECTION ITEM
GET POST /v1/linksColl/:id/links
response
POST /v1/linksColl/:id/links/(bulk)
request
- title (required),tags,category (required),isPublished,url (required)
response
PUT /v1/linksColl/:id/links/(bulk)
request
- _id (required)
- title,tags,category,isPublished,url
response
DELETE /v1/linksColl/:id/links/(bulk)
request
#todo
- 权限界定
- 不同场景下的返回内容
比如说 在query接口中只返回ReadersCount而不是所有等等
@dimpurr
LINKS COLLECTION
GET /v1/linksColl/:id
request
response
linksCollwith all its itemsGET /v1/linksColl/own
return all linksColls that the current user has created
request
0-> return all itemsn-> n itemsundefined-> only return metas (default)response
linksColl]GET /v1/linksColl/watch
return all linksColls that the current user watches
request
reponse
linksColl]GET /v1/linksColl/query
requests
user's _iduser's _idtimeresponse
linksColl]POST /v1/linksColl
create a linksColl without items
requests
creator)response
linksCollPUT /v1/linksColl
create a linksColl without items
requests
response
linksCollDELETE /v1/linksColl (not possible)
POST/DELETE /v1/linksColl/:id/tags/(:tagName)
modify tags
GET/POST/PUT/DELETE /v1/linksColl/:id/[readRequests,readers,watchers,collaborators]/(:id)
LINKS COLLECTION ITEM
GET POST /v1/linksColl/:id/links
response
linksColl item]POST /v1/linksColl/:id/links/(bulk)
request
response
linksColl item]PUT /v1/linksColl/:id/links/(bulk)
request
response
linksColl item]DELETE /v1/linksColl/:id/links/(bulk)
request
#todo
比如说 在query接口中只返回ReadersCount而不是所有等等
@dimpurr