adjust .rest file and readme for multi-site support

This commit is contained in:
Umputun
2017-12-27 18:07:53 -06:00
parent 2892e3d8d5
commit dfbd9b1829
2 changed files with 18 additions and 17 deletions
+8 -8
View File
@@ -81,7 +81,7 @@ type Locator struct {
}
```
- `GET /api/v1/find?url=post-url&sort=fld&format=tree` - find all comments for given post
- `GET /api/v1/find?site=site-id&url=post-url&sort=fld&format=tree` - find all comments for given post
This is the primary call used by UI to show comments for given post. It can return comments in two formats - `plain` and `tree`.
In plain format result will be sorted list of `Comment`. In tree format this is going to be tree-like structure with this structure:
@@ -99,12 +99,12 @@ type Node struct {
Sort can be `time` or `score`. Supported sort order with prefix -/+, i.e. `-time`. For `tree` mode sort will be applied to top-level comments only and all replies always sorted by time.
- `GET /api/v1/last/{max}` - get up to `{max}` last comments
- `GET /api/v1/id/{id}` - get comment by `id`
- `GET /api/v1/comments?user=id` - get comment by `user id`
- `GET /api/v1/count?url=post-url` - get comment's count for `{url}`
- `PUT /api/v1/vote/{id}?url=post-url&vote=1` - vote for comment. `vote`=1 will increase score, -1 decreases. _auth required_
- `DELETE /api/v1/admin/comment/{id}?url=post-url` - delete comment by `id`. _auth and admin required_
- `GET /api/v1/last/{max}?site=site-id` - get up to `{max}` last comments
- `GET /api/v1/id/{id}?site=site-id` - get comment by `id`
- `GET /api/v1/comments?site=site-id&user=id` - get comment by `user id`
- `GET /api/v1/count?site=site-id&url=post-url` - get comment's count for `{url}`
- `PUT /api/v1/vote/{id}?site=site-id&url=post-url&vote=1` - vote for comment. `vote`=1 will increase score, -1 decreases. _auth required_
- `DELETE /api/v1/admin/comment/{id}?site=site-id&url=post-url` - delete comment by `id`. _auth and admin required_
- `PUT /api/v1/admin/user/{userid}?site=site-id&block=1` - block or unblock user. _auth and admin required_
- `GET /api/v1/admin/export?site=side-id&block=1` - export all comments. _auth and admin required_
- `PUT /api/v1/admin/pin/{id}?url=post-url&pin=1` - pin or unpin comment. _auth and admin required_
- `PUT /api/v1/admin/pin/{id}?site=site-id&url=post-url&pin=1` - pin or unpin comment. _auth and admin required_
+10 -9
View File
@@ -1,12 +1,12 @@
### find request with tree
GET https://demo.remark42.com/api/v1/find?site=demo&url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=tree"
GET https://demo.remark42.com/api/v1/find?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=tree"
### find request with plain
GET https://demo.remark42.com/api/v1/find?url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=plain"
GET https://demo.remark42.com/api/v1/find?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=plain"
### last 10 comments
GET https://demo.remark42.com/api/v1/last/50
GET https://demo.remark42.com/api/v1/last/50?site=remark
### create commnet
POST https://demo.remark42.com/api/v1/comment
@@ -20,24 +20,25 @@ Content-Type: application/json
"ip": "127.0.0.1"
},
"locator": {
"url": "https://radio-t.com/blah1"
"url": "https://radio-t.com/blah1",
"site": "remark"
}
}
### pin comment
PUT https://demo.remark42.com/api/v1/admin/pin/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/&pin=1
PUT https://demo.remark42.com/api/v1/admin/pin/3665976683?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/&pin=1
### vote for comment
PUT https://demo.remark42.com/api/v1/vote/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/&vote=1
PUT https://demo.remark42.com/api/v1/vote/3665976683?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/&vote=1
### get user info
GET https://demo.remark42.com/api/v1/user
### get comment by id
GET https://demo.remark42.com/api/v1/id/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/
GET https://demo.remark42.com/api/v1/id/3665976683?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/
### get comment by user id
GET https://demo.remark42.com/api/v1/comments?user=umputun
GET https://demo.remark42.com/api/v1/comments?site=remark&user=umputun
### get counts
GET https://demo.remark42.com/api/v1/count?url=https://radio-t.com/p/2017/12/16/podcast-576/
GET https://demo.remark42.com/api/v1/count?site=remark&url=https://radio-t.com/p/2017/12/16/podcast-576/