You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A7: High-level architecture. Privileges. Web resources specification
This document catalogues the resources used by SegFault, and identifies their properties. These include references to the graphical interfaces, and the format of JSON responses. Furthermore, this artifact presents a documentation for the web application, including all operations over data: create, read, update, and delete.
1. Overview
This section presents an overview of the web application to implement, identifies the application's modules and briefly describes them. The web resources associated with each module are detailed in the individual documentation of each module.
M01: Authentication
Web resources associated with user authentication, includes the following system features: login/logout and registration.
M02: Individual Profile
Web resources associated with individual profile management, includes the following system features: view and edit personal profile information, view personal notifications and favorite questions.
M03: Messages
Web resources associated with questions, answers and their comments, includes the following system features: add, view, vote, report and delete questions, add, view, vote, report and delete answers and add, view, vote, report and delete comments.
M04: Categories
Web resources associated with categories, includes the following system features: list categories and search categories
M05: Static Pages
Web resources with static content are associated with this module: about and 404 page.
2. Permissions
This section defines the permissions used in the modules to establish the conditions of access to resources, in increasing order of restrictiveness.
PUB
Public
Group of users without privileges.
USR
User
Group of authenticated users.
OWN
Owner
Group of users that can update their profiles and have privileges regarding their messages (extension over the USR permissions).
MOD
Moderator
Group of Moderators that can manage any message (extension over the USR permissions).
3. Modules
This section documents each web resource of each module, indicating the URL, HTTP methods, the possible parameters, interfaces with the user (referring to the A3 artefact) — or JSON responses in the event of APIs.
3.1 Module M01: Authentication
Endpoints of module Authentication
These are the endpoints available in the Authentication module:
R101: Login Action /login
R102: Logout Action /logout
R103: Register Form /register
R104: Register Action /register
R101: Login Action
URL
/login
Description
This web resource logs the user into the system.
Request Body
+username: string (account username)
+password: string (account password)
Method
POST
Redirects
Reloads the page on success or failure.
Permissions
PUB
R102: Logout Action
URL
/logout
Description
This web resource logs out the authenticated user (or moderator).
Web resource that creates a new question based on the input received. Redirects to the new question page on success, and back to new question form on failure.
Method
POST
Request Body
+title: string (The question's title)
+content: string (The question's contents)
+categories: id[] (The question's categories's foreign keys)
Web resource that edits a previous question based on the input received. Redirects to the new question page on success, and back to edit question form on failure.
Method
PUT
Request Body
+author: integer (The question author's id)
?content: string (The question's contents)
?categories: id[] (The question's categories's foreign keys)
JSON response containing a list of questions and their contents.
{
"question": [
{
"id": 137,
"title": "Is there multiple inheritance in JAVA?",
"content": "I'm a C++ developer and have always been intrigued by thefact that some languages allow for multiple inheritance and othersdon't.\nIs there a deeper thought process behind this?","author": "sudomakemeasandwich",
"score": 120,
"correct_answer": 43,
"creation_time": "2018-04-07 14:11",
"category": [
{
"name": "JAVA",
"id": 1
},
{
"name": "OOP",
"id": 2
}
]
},
{
"id": 12,
"title": "Is javascript dynamically typed?",
"content": "I was wondering if javascript was a dynamically typed language?",
"author": "sudormrf",
"score": 10,
"correct_answer": 435,
"creation_time": "2018-03-01 10:03",
"category": [
{
"name": "JAVA",
"id": 1
},
{
"name": "OOP",
"id": 2
}
]
}
]
}
JSON02: Question {question}
JSON response containing a question's details and contents.
{
"question":
{
"id": 137,
"title": "Is there multiple inheritance in JAVA?",
"author": "sudomakemeasandwich",
"score": 120,
"correct_answer": 43,
"category": [
{
"name": "JAVA",
"id": 1
},
{
"name": "OOP",
"id": 2
}
],
"was_edited": true,
"content":
{
"version": "I'm a C++ developer and have always been intrigued by thefact that some languages allow for multiple inheritance and othersdon't.\nIs there a deeper thought process behind this?","creation_time": "2018-04-07 14:11",
"author": "sudomakemeasandwich"
}
}
}
JSON03: Comment {comment}
JSON response containing a comment's details and contents.
JSON response containing the contents of a user's profile.
{
"username": "sudomakemeasandwhich",
"background_img": "imgs/profile/standard-bg.png",
"profile_img": "imgs/profile/linuxislove.png",
"biography": "Better than uml only ..."
}
JSON06: Categories {category}[]
JSON response containing a list of categories and their information.
{
"category": [
{
"id": 21,
"name": "java",
"description": "Java is a general-purpose computer-programming languagethat is concurrent, class-based, object-oriented,[15] and specificallydesigned to have as few implementation dependencies as possible","num_posts" : 54
}
]
}
JSON07: Answers {answer}[]
JSON response containing a list of answers and their information.
12/04/2018: Deleted "Login Form" resource, as its not a separate page;
12/04/2018: Added links to all UIs;
12/04/2018: Reassessed the usefulness of response with status code 202 or 204, deleted most;
12/04/2018: Deleted UI field of R311-R314;
12/04/2018: Modified JSONs to include flag was_edited instead of all versions of a message;
12/04/2018: Corrected R402's URL;
12/04/2018: Added categories' foreign keys to JSON responses, and restricted to only categories foreign keys when adding a question (instead of a string) - R301, R308, R310;
13/04/2018: Corrected markdown typos;
16/04/2018: Added pagination to questions resources (extra URL parameter);