Update API documentation

master
Nikola Forró 7 years ago
parent 63b68f4b66
commit b4ea438572

@ -15,11 +15,11 @@ Example response:
```JSON
{
"id": 28,
"date": "2018-01-01",
"game": "IRL",
"text": "Cheese?",
"created_at": "2018-01-01T00:00:00",
"updated_at": "2018-01-01T00:00:00"
"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"
}
```
@ -30,7 +30,7 @@ GET /quotes
```
```BASH
curl --request GET --data 'https://ladylilia.com/quotes/api/quotes?filter=cheese&sort_by=date&sort_order=asc'
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)*
@ -40,20 +40,20 @@ Example response:
```JSON
[
{
"id": 28,
"date": "2018-01-01",
"game": "IRL",
"text": "Cheese?",
"created_at": "2018-01-01T00:00:00",
"updated_at": "2018-01-01T00:00:00"
"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": 42,
"date": "2018-02-02",
"game": "IRL",
"text": "Cheese!",
"created_at": "2018-02-02T00:00:00",
"updated_at": "2018-02-02T00: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"
}
]
```
@ -61,8 +61,8 @@ Example response:
Parameters:
* `filter` (optional) - Filter string
* `sort_by` (optional) - Sort field, `id`, `date`, `game` or `text`
* `sort_order` (optional) - Sort order, `asc`, `desc` or `random`
* `sort_by` (optional) - Sort field, one of `id`, `date`, `game`, `text`
* `sort_order` (optional) - Sort order, one of `asc`, `desc`, `random`
* `page_number` (optional) - Page number to retrieve
* `page_size` (optional) - Number of quotes per page
@ -73,7 +73,7 @@ POST /quotes
```
```BASH
curl --request POST --header 'X-Quotes-API-Key: $API_KEY' --data 'id=28&date=2018-01-01&game=IRL&text=Cheese?' 'https://ladylilia.com/quotes/api/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*
@ -81,7 +81,7 @@ curl --request POST --header 'X-Quotes-API-Key: $API_KEY' --data 'id=28&date=201
Parameters:
* `id` (required) - Quote ID
* `date` (required) - Date in ISO 8601 format
* `date` (required) - Date in **ISO 8601** format
* `game` (required) - Related game
* `text` (required) - Text of the quote
@ -92,14 +92,14 @@ PUT /quotes/:id
```
```BASH
curl --request PUT --header 'X-Quotes-API-Key: $API_KEY' --data 'date=2018-01-01&game=IRL&text=Cheese?' 'https://ladylilia.com/quotes/api/quotes/28'
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 format
* `date` (required) - Date in **ISO 8601** format
* `game` (required) - Related game
* `text` (required) - Text of the quote
@ -110,5 +110,5 @@ DELETE /quotes/:id
```
```BASH
curl --request DELETE --header 'X-Quotes-API-Key: $API_KEY' 'https://ladylilia.com/quotes/api/quotes/28'
curl --request DELETE --header 'X-Quotes-API-Key: $API_KEY' 'https://ladylilia.com/quotes/api/quotes/666'
```

Loading…
Cancel
Save