-
Notifications
You must be signed in to change notification settings - Fork 0
API documentation
- The base path for all API requests is https://www.freequiz.ch/api/
- Content-Type is
application/jsonunless specified otherwise
Work in progress
Work in progress
https://www.freequiz.ch/api/bug/create
- Request method: PUT
- Content: Required
- Authentication: Required
- Email confirmation: Required
Content:
{
"bug_report": {
"title": "title",
"body": "body",
"url": "url",
"platform": "platform",
"user_agent": "user_agent"
}
}Response: 201
{
"success": true,
"message": "Bug report created"
}Errors:
User not verified (user.notverified): Code 401, User has not yet confirmed their Email address
{
"success": false,
"token": "user.notverified",
"message": "Could report because user has no confirmed email address"
}Invalid fields (record.invalid): Code 422, "Could not create bug report", title or body are either to short or missing
{
"success": false,
"token": "record.invalid",
"errors": {
"title": [{
"error": "too_short",
"count": 3
}]
},
"message": "Could not create bug report"
}Work in progress
https://www.freequiz.ch/api/user/data
- Request method: GET
- Authentication: Required
- Content: No content
- Reponse: 200
{
"success": true,
"data": {
"username": "username",
"avatar_url": "avatar_url",
"email": "email",
"unconfirmed_email": null,
"role": "role",
"quizzes": 0,
"created_at": 1772374484,
"updated_at": 1772374497,
"settings": {
"locale": "en",
"dark_mode": true,
"write_amount": 2,
"cards_amount": 2,
"multi_amount": 2,
"round_amount": 10
},
"confirmation": {
"confirmed": false,
"confirmed_at": null
},
"logins": {
"count": 2,
"current_login_at": 1772374497,
"last_login_at": 1772374484,
"sessions": [
{
"purpose": "api",
"expires": 1803910497,
"last_activity": 1772374502,
"current_session": true,
"session_id": "session_id"
}
]
}
}
}https://www.freequiz.ch/api/user/logout
This request invalidated the current session and even if the access token is still known it cannot be used to authenticate anymore.
- Request method: DELETE
- Authentication: Required
- Content: No content
- Response: 200
{
"success": true,
"message": "Logged out"
}https://www.freequiz.ch/api/user/destroy_session/:session_id
This endpoint can be used to invalidate other sessions than the current one. Though the current one can also be invalidated using this endpoint. All required information to invalidate a session is the session_id which is obtained through the user data endpoint
- Request method: DELETE
- Authentication: Required
- Content: No content
- Response:
- 200: Session successfuly invalidated
- 404: Session does not exist anymore or does not belong to that user
200: Session successfuly invalidated
{
"success": true,
"message": "Session deleted"
}404: Session does not exist anymore or does not belong to that user
{
"success": false,
"token": "session.notfound",
"message": "Session to be deleted was not found or does not belong to the user"
}https://www.freequiz.ch/api/quiz/:quiz_id/report
- Request method: POST
- Content: Required
- Authentication: Required
- Email confirmation: Required
Content:
{
"quiz_report": {
"description": "description",
"sexual": false,
"violence": false,
"hate": false,
"spam": false,
"child_abuse": false,
"mobbing": false
}
}Reponse: 201
{
"success": true,
"message": "Quiz reported"
}Errors:
User not verified (user.notverified): Code 401, User has not yet confirmed their Email address
{
"success": false,
"token": "user.notverified",
"message": "Could report because user has no confirmed email address"
}Not found (quiz.notfound): Code 404, "Quiz doesn't exist"
{
"success": false,
"token": "quiz.notfound",
"message": "Quiz doesn't exist"
}Fields invalid (fields.invalid): Code 401: "Record invalid"
{
"success": false,
"token": "record.invalid",
"message": "Record invalid",
"errors": {}
}