From 6f71baf74cba2e1b568b343ad66412dcf528217a Mon Sep 17 00:00:00 2001 From: Umputun Date: Tue, 26 Dec 2017 02:55:55 -0600 Subject: [PATCH] add rest file with testing requests --- app/main.go | 14 ++++++++------ remark.rest | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 remark.rest diff --git a/app/main.go b/app/main.go index 8b8c8df2..5460f456 100644 --- a/app/main.go +++ b/app/main.go @@ -16,12 +16,14 @@ import ( ) var opts struct { - DBFile string `long:"db" env:"BOLTDB_FILE" default:"/tmp/remark.db" description:"bolt file name"` - SiteURL string `long:"site-url" env:"REMARK_URL" default:"http://remark.umputun.com:8080" description:"url to remark site"` - Admins []string `long:"admin" env:"ADMIN" default:"umputun@gmail.com" description:"admin(s) names" env-delim:","` - DevMode bool `long:"dev" env:"DEV" description:"development mode, no auth enforced"` - Dbg bool `long:"dbg" env:"DEBUG" description:"debug mode"` - BackupLocation string `long:"backup" env:"BACKUP_PATH" default:"/tmp" description:"backups location"` + DBFile string `long:"db" env:"BOLTDB_FILE" default:"/tmp/remark.db" description:"bolt file name"` + SiteURL string `long:"site-url" env:"REMARK_URL" default:"http://remark.umputun.com:8080" description:"url to remark"` + Admins []string `long:"admin" env:"ADMIN" default:"umputun@gmail.com" description:"admin(s) names" env-delim:","` + + DevMode bool `long:"dev" env:"DEV" description:"development mode, no auth enforced"` + Dbg bool `long:"dbg" env:"DEBUG" description:"debug mode"` + + BackupLocation string `long:"backup" env:"BACKUP_PATH" default:"/tmp" description:"backups location"` ServerCommand struct { SessionStore string `long:"session" env:"SESSION_STORE" default:"/tmp" description:"path to session store directory"` diff --git a/remark.rest b/remark.rest new file mode 100644 index 00000000..113a25e6 --- /dev/null +++ b/remark.rest @@ -0,0 +1,40 @@ + +### find request with tree +GET http://remark.umputun.com/api/v1/find?url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=tree" + +### find request with plain +GET http://remark.umputun.com/api/v1/find?url=https://radio-t.com/p/2017/12/16/podcast-576/&sort=time&format=plain" + +### last 10 comments +GET http://remark.umputun.com/api/v1/last/10 + +### create commnet +POST http://remark.umputun.com/api/v1/comment +Content-Type: application/json + +{ + "text": "comment blah http://radio-t.com", + "user" : { + "name": "umputun", + "id": "@umputun", + "ip": "127.0.0.1" + }, + "locator": { + "url": "https://radio-t.com/blah1" + } +} + +### pin comment +PUT http://remark.umputun.com/api/v1/admin/pin/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/&pin=1 + +### vote for comment +PUT http://remark.umputun.com/api/v1/vote/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/&vote=1 + +### get user info +GET http://remark.umputun.com/api/v1/user + +### get comment by id +GET http://remark.umputun.com/api/v1/id/3665976683?url=https://radio-t.com/p/2017/12/16/podcast-576/ + +### get counts +GET http://remark.umputun.com/api/v1/count?url=https://radio-t.com/p/2017/12/16/podcast-576/ \ No newline at end of file