1
0
justguestbook/README.md

86 lines
1.9 KiB
Markdown
Raw Normal View History

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.
- `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.
2022-10-19 03:25:43 +04:00
- `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.
2022-10-19 03:25:43 +04:00
- `500` if there are internal problems with service.