Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
api
js
php
sass
.editorconfig
.gitattributes
.gitignore
Gruntfile.js
README.md
humans.txt
index.html
index.php
package-lock.json
package.json
questionCreator.html
robots.txt

README.md

pwa-questions

Endpoints

/api/questions/read.php

GET

Returns a random question in the following json format:

{
    "id": "<question id>",
    "category": "sports",
    "first_alternative": "Lifting",
    "first_alternative_score": "4",
    "second_alternative": "Running",
    "second_alternative_score": "0"
}

/api/questions/read_by_category.php

GET

Takes a category as a query string parameter, example:

/api/questions/read_by_category.php ?category=sport

Returns a random question within the given category in the following json format:

{
    "id": "<question id>",
    "category": "sports",
    "first_alternative": "Lifting",
    "first_alternative_score": "4",
    "second_alternative": "Running",
    "second_alternative_score": "0"
}

/api/questions/read_by_id.php

GET

Takes a id as a query string parameter, example:

/api/questions/read_by_category.php ?id=1

Returns the corresponding question in the following json format:

{
    "id": "<question id>",
    "category": "sports",
    "first_alternative": "Lifting",
    "first_alternative_score": "4",
    "second_alternative": "Running",
    "second_alternative_score": "0"
}

/api/questions/update.php

Post

Used to vote on a question, accepts json in the following format in post body:

{
    "id": "<question id>",
    "first": "true/false",
}

/api/questions/create.php

Post

Used to create a new question, accepts json in the following format in the post body:

{
    "category": "<question category>",
    "first": "<question first option>",
    "second": "<question second option>",
}

/api/questions/delete.php

Delete

Used to delete a question, accepts json in the following format in the post body:

{
    "id": "<question id>",
}

Meta-data endpoints

/api/questions/read_categories.php

Get

Returns a list of all the current categories in the following json format:

    ["category1", "category2", "category3"]
You can’t perform that action at this time.