API Documentation v2.0

Requests list

All requests starts from base url and prefix api. What means base URL for all requests will be http://pocytat.ml/api and all requests are send by GET

# URL Params Description
1. /quote/all dateFrom string - format 'Y-m-d H:i:s' | null
faculty string | null
Returns array of all quotes matching requirements
2. /quote/random [ids] | null Returns random quote. If param ids is not empty, api will return quote with id which isn't in ids param array. If nothing will be found, it will set "repeat" flag to true and will reset ids param array.
3. /quote/single id Returns specific quote by it's id.
4. /quote/vote id
up (bool) - true, for up vote; false, for down vote
Up/down votes specific quote

Exmaple responses of endpoints

/quote/all

{
    "message": "",
    "data": [
        {
            "id": 8,
            "quote": "Do pracy!",
            "faculty": "WEAiI",
            "votes": 1,
            "views": 6
        },
        {
            "id": 11,
            "quote": "Pal Pan ten kod",
            "faculty": "WEAiI",
            "votes": 0,
            "views": 6
        }
    ]
}
                

/quote/random?ids=[11]

{
    "message": "",
    "data": [
        {
            "id": 8,
            "quote": "Do pracy!",
            "faculty": "WEAiI",
            "votes": 1,
            "views": 6
        }
    ]
}
                

/quote/single?id=8

{
    "message": "",
    "data": [
        {
            "id": 8,
            "quote": "Do pracy!",
            "faculty": "WEAiI",
            "votes": 1,
            "views": 6
        }
    ]
}
                

/quote/vote?id=8&up=true

{
    "message": "Vote has been saved"
}