Skip to content

pombredanne/goqdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goqdb

Quote Database in Go

usage

requirements

running

revel run github.com/PacketFire/goqdb

api

QdbView

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

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.

Retrieve entries by date

Quotes from the current year

GET /api/v0

Specifying a date range

Year:

GET /api/2010

Month:

GET /api/2010/7

Day:

GET /api/v0/2010/7/1

Insert a new entry

POST /api/v0

Accepts Quote, Author and Tags fields of a QdbView

Note: POST returns 201 Created on success and 400 Bad Request if the post data did not pass validation

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-Length: 135
Content-Type: application/json
Date: Mon, 25 Nov 2013 16:11:28 GMT
Set-Cookie: REVEL_FLASH=; Path=/
Set-Cookie: REVEL_SESSION=64172d7dab5d922c6cdc2ca993e72647e3585d75-%00_TS%3A1387987888%00; Path=/; Expires=Wed, 25 Dec 2013 16:11:28 UTC

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

Retrieve quote entry

:id is used here in place of the quote id for the target entry

GET /api/v0/:id/view

Upvote a quote

PUT /api/v0/:id/rating

Downvote a quote

DELETE /api/v0/:id/rating

About

Quote Database in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published