NIAEFEUP Website - Backend API specification (0.0.1-SNAPSHOT)

Download OpenAPI specification:Download

This specification documents the available endpoints and possible operations on the website's backend. For each of the operations, its purpose, security, requests and possible responses are documented.

Postman collection also available here.

Authentication

Endpoints and operations for authentication management.

Check access token

This endpoint operation allows to check if a given access token is valid, returning the associated account's information.

Authorizations:
None
header Parameters
Authorization
required
string
Example: Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNzA3MjM0NjI1LCJpYXQiOjE3MDcyMzEwMjUsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.76moygjz0lPoMN_-CHDC4EA3IMvnYh-4CY4G-EDCYyJtP5Gwc4QgWr8ehVib_PnhIUP83aey3zijxM89aE-Bv7LpesEsqgJLMiR6hiXxdp8JTBiNOlhJxedPOnD8x8-tDIxx-TRGhzVjNAkRLjeu-mDGdpzZdh2HuNx-lCGM8wxr2EtW7ls-vH1f_zx5rrqQ7S-ESVJKB-XoRbRcRpAADx20VIbTQF17oTwT8GgC5jk9nBJP48Ai9B-F54vxXGK9fKY-JH8_tfX0dh7-Zpxd-JiaIsD8Lq4FsEGxqzu5rfhVSJM02tKxILh0LH0cBjBuW3OzULbmmHU69iSo5xrpfQ

Bearer authentication token

Responses

Response samples

Content type
application/json
{}

Authenticate account

This endpoint operation allows authentication using user's password and email, generating new access and refresh tokens to be used in following requests.

Request Body schema: application/json;charset=UTF-8
password
string

Password of the account

email
string

Email of the account

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "email": "test_account@test.com",
  • "password": "testPassword"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNzA3MjM0NjI2LCJpYXQiOjE3MDcyMzEwMjYsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.XPEEzAL6dYjYYzG9Bnm_AliGFZzWbACfsgfEohpj9a680tbL6CaMc0403sZAkiqi2JHMwVj3u_bdrpGpYi1KuRIxJbl9zXT2EpGM4SDwWk4k_lLP9nPmeMtRhNPWbYZhWzxh56kdCrjgSC0GwlFKa58-gJjr9cW9lW8MmQ6l2d4hrJ6XBX5e6r4JxmeomBI-o8Kmn6ajHWIOjqVNaPIWHFj9oe8CyZr-mJEUL35nxW-gdQDCFY2POlrCySy_GXSdDoHV1LezF65loGALRFE5s5R_iVnDSsU2Xk1UBPoOR-Ad3_GlRO4j1FSAdWPWFJwGYDNwP5boKalFLhzT_wLWpg",
  • "refresh_token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNzA3ODM1ODI2LCJpYXQiOjE3MDcyMzEwMjYsInNjb3BlIjoiIn0.wshlLHgWGt-sbRnj4mCMN8-aU_ldRVxUGFDMoVeC8QU6wCatTBBLb5u6TUQmKw_e87ecnT278NWLz4tar5lfZOsiKJcNjVapoRHZPb-24W_oGhvei89L0PrXqYu_BhH7GtCvb43ATgTLDdkIqP59q5IUNbjdb65Gj_M5shZAdCLMSVzX2746vH-bveJN2gBhLIf9Kg_zQnhF2DuIGYEIffC_voXiBvqVAacaBiQgwx2z4CdkkTXp6psR4C_8OjLxHTp6XfQontYYWLgwLVoC9YmMKMMmuDZwzilXGHTMFtbQBM32ggjlNo0WT_RnhBsacY5NdhWEekYSmeAHKoSa8w"
}

Refresh access token

This endpoint operation allows the renewal of the access token, using the currently valid refresh token.

Request Body schema: application/json;charset=UTF-8
token
string

Refresh token, used to refresh the access token

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNzA3ODM1ODI2LCJpYXQiOjE3MDcyMzEwMjYsInNjb3BlIjoiIn0.wshlLHgWGt-sbRnj4mCMN8-aU_ldRVxUGFDMoVeC8QU6wCatTBBLb5u6TUQmKw_e87ecnT278NWLz4tar5lfZOsiKJcNjVapoRHZPb-24W_oGhvei89L0PrXqYu_BhH7GtCvb43ATgTLDdkIqP59q5IUNbjdb65Gj_M5shZAdCLMSVzX2746vH-bveJN2gBhLIf9Kg_zQnhF2DuIGYEIffC_voXiBvqVAacaBiQgwx2z4CdkkTXp6psR4C_8OjLxHTp6XfQontYYWLgwLVoC9YmMKMMmuDZwzilXGHTMFtbQBM32ggjlNo0WT_RnhBsacY5NdhWEekYSmeAHKoSa8w"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNzA3MjM0NjI2LCJpYXQiOjE3MDcyMzEwMjYsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.XPEEzAL6dYjYYzG9Bnm_AliGFZzWbACfsgfEohpj9a680tbL6CaMc0403sZAkiqi2JHMwVj3u_bdrpGpYi1KuRIxJbl9zXT2EpGM4SDwWk4k_lLP9nPmeMtRhNPWbYZhWzxh56kdCrjgSC0GwlFKa58-gJjr9cW9lW8MmQ6l2d4hrJ6XBX5e6r4JxmeomBI-o8Kmn6ajHWIOjqVNaPIWHFj9oe8CyZr-mJEUL35nxW-gdQDCFY2POlrCySy_GXSdDoHV1LezF65loGALRFE5s5R_iVnDSsU2Xk1UBPoOR-Ad3_GlRO4j1FSAdWPWFJwGYDNwP5boKalFLhzT_wLWpg"
}

Accounts

Endpoints and operations for account management.

Get all the accounts

The operation returns an array of accounts, allowing to easily retrieve all the created accounts.

Responses

Response samples

Content type
application/json
[]

ACCOUNT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

ACCOUNT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

Get accounts by ID

This endpoint allows the retrieval of a single account using its ID.

path Parameters
id
required
string

ID of the account to retrieve

Responses

Response samples

Content type
application/json
{}

Delete accounts

This operation deletes an account using its ID.

path Parameters
id
required
string

ID of the account to delete

Responses

Response samples

Content type
application/json
{ }

Change account password

Replaces sets a new account password

path Parameters
id
required
string

ID of the account to change the password.

Request Body schema: application/json;charset=UTF-8
oldPassword
string

Current account password

newPassword
string

New account password

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "oldPassword": "wrong_password",
  • "newPassword": "test_password2"
}

Response samples

Content type
application/json
{ }

Events

Endpoints and operations for event management.

Get all the events or filter them by category

The operation returns an array of events, allowing to easily retrieve all the created events. It also allows to filter the events by category, using the query parameter "category". This is useful for example in the frontend's event page, where events are displayed.

query Parameters
category
string

Category of the events to retrieve

Responses

Response samples

Content type
application/json
Example
[]

EVENT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

EVENT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

EVENT/UpdateEvent/should fail if the event does not exist

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Get events by ID

This endpoint allows the retrieval of a single event using its ID. It might be used to generate the specific event page.

path Parameters
id
required
string

ID of the event to retrieve

Responses

Response samples

Content type
application/json
{}

Delete events

This operation deletes an event using its ID.

path Parameters
id
required
string

ID of the event to delete

Responses

Response samples

Content type
application/json
{ }

Get events by slug

This endpoint allows the retrieval of a single event using its slug.

path Parameters
slug
required
string

Short and friendly textual event identifier

Responses

Response samples

Content type
application/json
{}

Get events by category

This endpoint allows the retrieval of events labeled with a given category. It might be used to filter events in the event page.

path Parameters
category
required
string

Category of the events to retrieve

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {}
]

Add team member to event

This operation adds a team member to a given event.

path Parameters
eventId
required
string

ID of the event to add the member to

accountId
required
string

ID of the account to add

Responses

Response samples

Content type
application/json
{}

Remove a team member from event

This operation removes a team member of a given event.

path Parameters
eventId
required
string

ID of the event to remove the member from

accountId
required
string

ID of the account to remove

Responses

Response samples

Content type
application/json
{
  • "title": "Great event",
  • "description": "This was a nice and iconic event",
  • "teamMembers": [ ],
  • "slug": "great-event",
  • "image": "cool-image.png",
  • "gallery": [ ],
  • "dateInterval": {
    },
  • "location": "FEUP",
  • "category": "Great Events",
  • "id": 1
}

Generations

Endpoints and operations for generations management.

Get all the school years with recorded generations

This returns an array of years with recorded generations, allowing other operations on the generations themselves.

Responses

Response samples

Content type
application/json
[
  • "22-23",
  • "21-22"
]

Create new generations

This operation creates a new generation.

Request Body schema: application/json;charset=UTF-8
Array of objects

Roles associated with the generation

schoolYear
string

School year of the generation

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "roles": [ ]
}

Response samples

Content type
application/json
Example
{
  • "schoolYear": "22-23",
  • "id": 1,
  • "roles": [ ]
}

Get the latest generation

This operation retrieves the latest generation using its id.

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Get a generation by id

This operation retrieves the generation using its id.

path Parameters
id
required
string

Id of a generation

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Delete a generation by its id

Delete a generation by its id, using its id as a parameter

path Parameters
id
required
string

Id of a generation

Responses

Response samples

Content type
application/json
{ }

Update a generation school year by its Id

Update a generation school year, using its Id as a parameter

path Parameters
id
required
string

Id of a generation

Request Body schema: application/json;charset=UTF-8
schoolYear
string

New school year

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "schoolYear": "123"
}

Response samples

Content type
application/json
{
  • "schoolYear": "19-20",
  • "id": 1,
  • "roles": [
    ]
}

Get generation by school year

This operation retrieves the generation associated with a given school year.

path Parameters
schoolYear
required
string

School year associated with a generation

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Delete a generation by its school year

Delete a generation by its school year, using its school year as a parameter

path Parameters
schoolYear
required
string

School year associated with a generation

Responses

Response samples

Content type
application/json
{ }

Update a generation school year by its school year

Update a generation school year, using its school year as a parameter

path Parameters
schoolYear
required
string

School year associated with a generation

Request Body schema: application/json;charset=UTF-8
schoolYear
string

New school year

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "schoolYear": "123"
}

Response samples

Content type
application/json
{
  • "schoolYear": "19-20",
  • "id": 1,
  • "roles": [
    ]
}

Posts

Endpoints and operations for post management.

Get all the posts

The operation returns an array of posts, allowing to easily retrieve all the created posts.

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Create new posts

This endpoint operation creates a new post.

Request Body schema: application/json;charset=UTF-8
thumbnailPath
string

Path for the post thumbnail image

body
string

Post body

title
string

Post title

slug
string

Short and friendly textual post identifier

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{}

Response samples

Content type
application/json
{
  • "title": "New test released",
  • "body": "this is a test post",
  • "thumbnailPath": "https://thumbnails/test.png",
  • "publishDate": "06-02-2024",
  • "lastUpdatedAt": "06-02-2024 14:50:31",
  • "id": 1,
  • "slug": "new-test-released"
}

Get posts by ID

This endpoint allows the retrieval of a single post using its ID. It might be used to generate the specific post page.

path Parameters
id
required
string

ID of the post to retrieve

Responses

Response samples

Content type
application/json
{
  • "title": "New test released",
  • "body": "this is a test post",
  • "thumbnailPath": "https://thumbnails/test.png",
  • "publishDate": "06-02-2024",
  • "lastUpdatedAt": "06-02-2024 14:50:32",
  • "id": 1,
  • "slug": "new-test-released"
}

Update posts

Update a previously created post, using its ID.

path Parameters
id
required
string

ID of the post to update

Request Body schema: application/json;charset=UTF-8
thumbnailPath
string

Path for the post thumbnail image

body
string

Post body

title
string

Post title

slug
string

Short and friendly textual post identifier

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "title": "New test released",
  • "body": "this is a test post",
  • "thumbnailPath": "https://thumbnails/test.png",
  • "slug": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Response samples

Content type
application/json
Example
{
  • "title": "New Title",
  • "body": "New Body of the post",
  • "thumbnailPath": "https://thumbnails/new.png",
  • "publishDate": "06-02-2024",
  • "lastUpdatedAt": "06-02-2024 14:50:32",
  • "id": 1,
  • "slug": "new-slug"
}

Delete posts

This operation deletes an event using its ID.

path Parameters
id
required
string

ID of the post to delete

Responses

Response samples

Content type
application/json
{ }

Get posts by slug

This endpoint allows the retrieval of a single post using its slug. It might be used to generate the specific post page.

path Parameters
slug
required
string

Short and friendly textual post identifier

Responses

Response samples

Content type
application/json
{
  • "title": "New test released",
  • "body": "this is a test post",
  • "thumbnailPath": "https://thumbnails/test.png",
  • "publishDate": "06-02-2024",
  • "lastUpdatedAt": "06-02-2024 14:50:32",
  • "id": 1,
  • "slug": "new-test-released"
}

Projects

Endpoints and operations for project management.

Get all the projects

The operation returns an array of projects, allowing to easily retrieve all the created projects. This is useful for example in the frontend project page, where projects are displayed.

Responses

Response samples

Content type
application/json
[]

PROJECT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

PROJECT/

Responses

Response samples

Content type
application/json
Example
{
  • "errors": [
    ]
}

PROJECT/UpdateProject/should fail if the project does not exist

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Get projects by ID

This endpoint allows the retrieval of a single project using its ID. It might be used to generate the specific project page.

path Parameters
id
required
string

ID of the project to retrieve

Responses

Response samples

Content type
application/json
{}

Delete projects

This operation deletes an projects using its ID.

path Parameters
id
required
string

ID of the project to delete

Responses

Response samples

Content type
application/json
{ }

Get projects by slug

This endpoint allows the retrieval of a single project using its slug.

path Parameters
slug
required
string

Short and friendly textual project identifier

Responses

Response samples

Content type
application/json
{}

Archive projects

This endpoint archives a project. This is useful to mark no longer maintained or complete projects.

path Parameters
id
required
string

ID of the project to archive

Responses

Response samples

Content type
application/json
{}

Unarchive projects

This endpoint unarchives a project. This is useful to mark previously archived projects as active.

path Parameters
id
required
string

ID of the project to unarchive

Responses

Response samples

Content type
application/json
{
  • "title": "proj1",
  • "description": "very cool project",
  • "teamMembers": [ ],
  • "image": "cool-image.png",
  • "gallery": [ ],
  • "isArchived": false,
  • "technologies": [
    ],
  • "slogan": "Nice one",
  • "targetAudience": "students",
  • "links": [ ],
  • "hallOfFame": [ ],
  • "timeline": [ ],
  • "id": 1
}

Add account to the Project's Hall Of Fame

This operation adds an account to a given project's hall of fame.

path Parameters
idProject
required
string

ID of the project whose hall of fame the account will be added to

idAccount
required
string

ID of the account to add

Responses

Response samples

Content type
application/json
{}

Remove account from Project's Hall of Fame

This operation removes an account from a given project's hall of fame.

path Parameters
idProject
required
string

ID of the project whose hall of fame the account will be removed from

idAccount
required
string

ID of the account to remove

Responses

Response samples

Content type
application/json
{}

Add team member to Project

This operation adds a team member to a given project.

path Parameters
projectId
required
string

ID of the project to add the member to

accountId
required
string

ID of the account to add

Responses

Response samples

Content type
application/json
{}

Remove team member from Project

This operation removes a team member of a given project.

path Parameters
projectId
required
string

ID of the project to remove the member from

accountId
required
string

ID of the account to remove

Responses

Response samples

Content type
application/json
{}

Role Management

Returns all existing roles

This endpoint returns all existing roles in the database for ease of use.

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

This creates a role, returning the complete role information

It will only create the role if it no other role with the same name exists in that generation

Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "name": "TestRole",
  • "permissions": [
    ],
  • "isSection": false,
  • "associatedActivities": [ ],
  • "accounts": [ ]
}

Response samples

Content type
application/json
Example
{
  • "name": "Coordenador de Projetos",
  • "permissions": [
    ],
  • "isSection": false,
  • "id": 2,
  • "associatedActivities": [ ]
}

Returns a specific role

Returns a summary brief of a specific role, which makes getting one role way more efficient.

path Parameters
id
required
string

ID of the role to retrieve

Responses

Response samples

Content type
application/json
{
  • "name": "TestRole",
  • "permissions": [
    ],
  • "isSection": false,
  • "id": 1,
  • "associatedActivities": [ ]
}

Updates role information by ID

Updates some role information (eg: name and isSection). It will throw an error if the desired name already exists on role generation or if role doesn't exist.

path Parameters
id
required
string
Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "name": "Membro",
  • "isSection": true
}

Response samples

Content type
application/json
{
  • "name": "Membro",
  • "permissions": [
    ],
  • "isSection": true,
  • "id": 1,
  • "associatedActivities": [ ]
}

Removes the role by its id

The id must exist in order to remove it correctly

path Parameters
id
required
string

ID of the role to delete

Responses

Response samples

Content type
application/json
{
  • "errors": [
    ]
}

Adds a set of permissions to a role by ID

This doesn't check if the permission is already added, the role ID must be valid

path Parameters
id
required
string

ID of the role to grant permissions to

Request Body schema: application/json;charset=UTF-8
object (roles-id-permissions486549215)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{ }

Revokes permission by role ID

Revokes permissions, it doesn't check if the role contains them.

path Parameters
id
required
string

ID of the role to revoke permissions from

Request Body schema: application/json;charset=UTF-8
object (roles-id-permissions486549215)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{ }

Add an account to a role by its IDs

It's an idempotent endpoint so it will return HTTP code 200 even if the user is already in the role

path Parameters
id
required
string

ID of the role to add an user

Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "userId": 1
}

Response samples

Content type
application/json
{ }

Removes the account from the role by ID

It only works if the user has the role and it exists

path Parameters
id
required
string

ID of the role to remove an user from

Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "userId": 1234
}

Response samples

Content type
application/json
{ }

Adds an permission to a role activity

It will create a PerRoleActivity if it doesn't exist

path Parameters
id
required
string

ID of the role

activityId
required
string

ID of the activity

Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{ }

Removes an PerRoleActivity permission by ID

It will not create a PerRoleActivity if it doesn't exist, it will simply return, doesn't check if the permissions are already revoked...

path Parameters
id
required
string

ID of the role

activityId
required
string

ID of the activity

Request Body schema: application/json;charset=UTF-8
object (roles-request)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "permissions": [
    ]
}

Response samples

Content type
application/json
{ }