1
0
Fork 0
A guestbook service with owner's replies.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Alexander Andreev be5d0782b6
Changed Update() handler accordingly to a new logic.
2 months ago
bin Initial commit. 2 months ago
build/archlinux Initial commit. 2 months ago
cmd/justguestbookd Added PUT endpoints in main. 2 months ago
configs Currently only regular TCP connections to captcha service supported. 2 months ago
init Initial commit. 2 months ago
internal Changed Update() handler accordingly to a new logic. 2 months ago
pkg Added PUT method to HttpServer. 2 months ago
.gitignore Initial commit. 2 months ago
LICENSE Initial commit. 2 months ago
Makefile Initial commit. 2 months ago
README.md Removed 404 for GET /. 204 changed to 201 for POST /:entry/reply. Specified 404 for DELETE /:entry/reply. 2 months ago
go.mod Initial commit. 2 months ago
go.sum Initial commit. 2 months ago

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.