1
0
Fork 0
A guestbook service with owner's replies.
Go to file
Alexander Andreev be5d0782b6
Changed Update() handler accordingly to a new logic.
2022-10-21 04:38:53 +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 Added PUT endpoints in main. 2022-10-21 04:22:26 +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 Changed Update() handler accordingly to a new logic. 2022-10-21 04:38:53 +04:00
pkg Added PUT method to HttpServer. 2022-10-21 03:21:53 +04:00
.gitignore 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 Removed 404 for GET /. 204 changed to 201 for POST /:entry/reply. Specified 404 for DELETE /:entry/reply. 2022-10-21 03:21:05 +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

README.md

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.
  • 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

  • 201 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 or reply.
  • 500 if there are internal problems with service.