Skip to content

PacketFire/goqdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goqdb

Quote Database in Go

usage

requirements

running

revel run github.com/PacketFire/goqdb

API

Quote

Name Type Description
QuoteId int The quote id
Quote string The quote body
Author string The author of the quote
Created int64 unix time in seconds
Rating int The quote's rating
Tags []string An array of tag strings, white space is trimmed from either side
UserId string Author's user id hash

All resources return 200 on success or 500 with an undefined body if fatal errors were encountered. Resources requiring an id return a 404 with undefined body if the id does not exist in the database.

Index

GET /api/v1
GET /api/v1/:id

Parameters

id return single entry
tag return quotes with tag
search search quotes
from date string in the form mm/dd/yyyy
to same as above
sort one of relevence, rating, date, random
desc boolean, sort in descending order
size maximum amount of entries to return, capped at 4096 by default

Insert a new entry

POST /api/v1

Accepts Quote, Author and Tags fields of a Quote

Request:

POST /api/v0/ HTTP/1.1
Content-Type: application/json
Content-Length: 58

{"Quote": "test", "Author": "jgr", "Tags": ["foo", "bar"]}

Response:

HTTP/1.1 201 Created
Content-Type: application/json	
...

{
  "QuoteId": 20,
  "Quote": "test",
  "Created": 1385395888,
  "Rating": 0,
  "Author": "jgr",
  "Tags": [
    "foo",
    "bar"
 ]
}

Vote

PATCH /api/v1/:id/:typ

Parameters

id target id
typ one of up, down, delete

About

Quote Database in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published