1
0
A guestbook service with owner's replies.
Go to file
2022-10-21 03:03:05 +04:00
bin Initial commit. 2022-10-19 03:25:43 +04:00
build/archlinux Initial commit. 2022-10-19 03:25:43 +04:00
cmd/justguestbookd A little more informative log. Error removed from handlers because it doesn't return them. :) 2022-10-21 02:59:34 +04:00
configs Currently only regular TCP connections to captcha service supported. 2022-10-21 03:00:24 +04:00
init Initial commit. 2022-10-19 03:25:43 +04:00
internal Made use of http.Error(). Removed error return from New() func. Added StatusCreated header to Reply() method. 2022-10-21 03:03:05 +04:00
pkg/server Initial commit. 2022-10-19 03:25:43 +04:00
test Initial commit. 2022-10-19 03:25:43 +04:00
.gitignore Initial commit. 2022-10-19 03:25:43 +04:00
go.mod Initial commit. 2022-10-19 03:25:43 +04:00
go.sum Initial commit. 2022-10-19 03:25:43 +04:00
LICENSE Initial commit. 2022-10-19 03:25:43 +04:00
Makefile Initial commit. 2022-10-19 03:25:43 +04:00
README.md Initial commit. 2022-10-19 03:25:43 +04:00

justguestbook ver. 1.0.0

Usage

justguestbookd -conf /etc/justguestbook.yaml

API summary

GET /?p=&psz=
POST /
    data: captcha_id=&name=&message=[&website=&hide_website=1]
DELETE /:entry

POST /:entry/reply
    data: reply=
DELETE /:entry/reply

Public API

Get a list of guestbook entries

GET /?p=&psz=

URL query parameters

  • p= is a page number. By default first page will be returned.
  • psz= is a page size. By default will be used page size set by a service.

HTTP codes

  • 200 if there are entries.
  • 404 if there's no entries.
  • 500 if for some reason a list cannot be sent.

Post a new guestbook entry

POST /

Fields

  • captcha_id is an ID of CAPTCHA stored in a justcaptcha service.
  • name of a poster. Optional. Service's default if not set.
  • message a poster want to post. Required.
  • website of a poster. Optional.
  • hide_website if true hide website. Optional. Hide by default.

HTTP codes

  • 201 if created
  • 422 if some required field doesn't present.
  • 500 if for some reason post cannot be stored.

A 500 response should return a message back.

Administration API

All such commands must have a password supplied in X-Password header.

Send a reply to entry

POST /:entry/reply

Fields

  • message for an entry. Required.

HTTP codes

  • 204 if created or modified successfully.
  • 403 if unauthorised.
  • 404 if there's no such entry.
  • 500 if there are internal problems with service.

Delete an entry

DELETE /:entry

HTTP codes

  • 204 if was successfully deleted.
  • 403 if unauthorised.
  • 404 if there's no such entry.
  • 500 if there are internal problems with service.

Delete a reply

DELETE /:entry/reply

HTTP codes

  • 204 if was successfully deleted.
  • 403 if unauthorised.
  • 404 if there's no such entry.
  • 500 if there are internal problems with service.