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.
Nikola Forró
2e149bfebe
|
6 years ago | |
---|---|---|
.. | ||
.gitignore | 6 years ago | |
Dockerfile | 6 years ago | |
README.md | 6 years ago | |
app.py | 6 years ago | |
db.py | 6 years ago | |
generate_api_key.py | 6 years ago | |
requirements.txt | 6 years ago |
README.md
HTTP API documentation
Get specific quote
GET /quotes/:id
curl --request GET 'https://ladylilia.com/quotes/api/quotes/28'
Example response:
{
"id": 28,
"date": "2017-10-16",
"game": "Call of Cthulhu: Shadow of the Comet",
"text": "Hey, nerd. Sit down so I can have speaks with you.",
"created_at": "2018-04-29T20:00:00",
"updated_at": "2018-04-29T20:00:00"
}
Get list of quotes
GET /quotes
curl --request GET --data 'https://ladylilia.com/quotes/api/quotes?filter=balls&sort_by=date&sort_order=asc'
Note: X-Total-Count
header is set to a total number of quotes after filtering (useful for pagination)
Example response:
[
{
"id": 6,
"date": "2017-10-10",
"game": "The Elder Scrolls IV: Oblivion",
"text": "Being a vampire in Oblivion sucks balls.",
"created_at": "2018-04-29T20:00:00",
"updated_at": "2018-04-29T20:00:00"
},
{
"id": 25,
"date": "2017-10-12",
"game": "Alien: Isolation",
"text": "Holy balls!",
"created_at": "2018-04-29T20:00:00",
"updated_at": "2018-04-29T20:00:00"
}
]
Parameters:
filter
(optional) - Filter stringsort_by
(optional) - Sort field, one ofid
,date
,game
,text
sort_order
(optional) - Sort order, one ofasc
,desc
,random
page_number
(optional) - Page number to retrievepage_size
(optional) - Number of quotes per page
Create quote
POST /quotes
curl --request POST --header 'X-Quotes-API-Key: $API_KEY' --data 'id=666&date=2018-10-31&game=IRL&text=Cheese' 'https://ladylilia.com/quotes/api/quotes'
Note: the quote is replaced if it exists already
Parameters:
id
(required) - Quote IDdate
(required) - Date in ISO 8601 formatgame
(required) - Related gametext
(required) - Text of the quote
Replace specific quote
PUT /quotes/:id
curl --request PUT --header 'X-Quotes-API-Key: $API_KEY' --data 'date=2018-10-31&game=IRL&text=Coffee' 'https://ladylilia.com/quotes/api/quotes/666'
Note: the quote is created if it doesn't exist yet
Parameters:
date
(required) - Date in ISO 8601 formatgame
(required) - Related gametext
(required) - Text of the quote
Delete specific quote
DELETE /quotes/:id
curl --request DELETE --header 'X-Quotes-API-Key: $API_KEY' 'https://ladylilia.com/quotes/api/quotes/666'