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.

header Parameters
Authorization
required
string
Example: Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNjk1MTM5ODI1LCJpYXQiOjE2OTUxMzYyMjUsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.oM6-bnapkQTLNyR1-9TFPXSs6pfeh6uXGwdSoIL0Sr1smhvMbRgRGTi5qjInlKQ2oVkj0AyaavNFryCmpoYbzURCWANCPGjOKZdC_pi4gm-liFmVoo029QmThr8X_OXVBhC25mt2GK1T6u7SfOb0-G7DIYRihFZpQLYHaDk0_YfxmNC9QbrMgvDCCallzPgcmr2hIOMVL71Q35TXzDNQbxzNeMRCY0a_cDi7Ce5Fxa3QPp9cQZLrVy9_QfVuJDs56BIFKC-5CwXrYwa3pZW26jyphEP3qBEN076GYVMZPF5wcJOpvQ3OJExPkLQDncvTpyyF9XwCBFhYuJ8n5o3X0g

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.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNjk1MTM5ODI2LCJpYXQiOjE2OTUxMzYyMjYsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.PuiRn_xjvK_A6_NucXvYkIeytL8GSTCsDG5yJXDyiX2BSq912quzy91pkP0NkO6akThKTelSWgbUPk5WpGcFPYQbIUohkCxbRQaaAtL3uniXwmH87RMATWCTvKXqt05YSkraAQABkSQrx1McXX6l-_5N3BQu_G1v_DMTc7NB7NBzHjQDDxe_UPDlcILzEsTbSeCxNHILbC38KvXSqybVu9P_WlQiGkUT9Jphx9FSr4ZK8016vA69sbCUW5u3cx1efxFLUdCSM56lndjkD2CNkyZPKh3TiBZyblz7ssV6XUtYDxFz6J-tzhnNkc0QJE2-Qgnxtr2uOt4MF7p3087ouw",
  • "refresh_token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNjk1NzQxMDI2LCJpYXQiOjE2OTUxMzYyMjYsInNjb3BlIjoiIn0.aiGgfEs8ywJNEMDqR5Oq81J0fMWu1YJ4X_hmC7Rgd6YCmfUAWBZbOCM_DRUjrcJMXNRgWE9VdY9Okbf-VZ32HZ_oXievH3MJ-ghVxzuEnEZhHFm-aSbKzf3zhGHpsBll4dBPp6CMqYhYsi7gQEX9RX6XXSiCZbH4krlj153s4_dFe63VKPCD1dbfIw0Lh7phqKFONZW-Cjxp2VrtdxpJxtVev4-lKVM6v_-qjwUMMefju53-k73AyG2PwVgtKLJIX-VAWvzHVj-MEfDPS60yJFOZnqhpjAAdBdfwlzjvK0xVxouO2EvQI4pQeioJVuXpM-8sFRy7AVUA2Us2XK6W4Q"
}

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.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNjk1NzQxMDI2LCJpYXQiOjE2OTUxMzYyMjYsInNjb3BlIjoiIn0.aiGgfEs8ywJNEMDqR5Oq81J0fMWu1YJ4X_hmC7Rgd6YCmfUAWBZbOCM_DRUjrcJMXNRgWE9VdY9Okbf-VZ32HZ_oXievH3MJ-ghVxzuEnEZhHFm-aSbKzf3zhGHpsBll4dBPp6CMqYhYsi7gQEX9RX6XXSiCZbH4krlj153s4_dFe63VKPCD1dbfIw0Lh7phqKFONZW-Cjxp2VrtdxpJxtVev4-lKVM6v_-qjwUMMefju53-k73AyG2PwVgtKLJIX-VAWvzHVj-MEfDPS60yJFOZnqhpjAAdBdfwlzjvK0xVxouO2EvQI4pQeioJVuXpM-8sFRy7AVUA2Us2XK6W4Q"
}

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoidGVzdF9hY2NvdW50QHRlc3QuY29tIiwiZXhwIjoxNjk1MTM5ODI2LCJpYXQiOjE2OTUxMzYyMjYsInNjb3BlIjoiQk9BUkQgTUVNQkVSIn0.PuiRn_xjvK_A6_NucXvYkIeytL8GSTCsDG5yJXDyiX2BSq912quzy91pkP0NkO6akThKTelSWgbUPk5WpGcFPYQbIUohkCxbRQaaAtL3uniXwmH87RMATWCTvKXqt05YSkraAQABkSQrx1McXX6l-_5N3BQu_G1v_DMTc7NB7NBzHjQDDxe_UPDlcILzEsTbSeCxNHILbC38KvXSqybVu9P_WlQiGkUT9Jphx9FSr4ZK8016vA69sbCUW5u3cx1efxFLUdCSM56lndjkD2CNkyZPKh3TiBZyblz7ssV6XUtYDxFz6J-tzhnNkc0QJE2-Qgnxtr2uOt4MF7p3087ouw"
}

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

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

Responses

Response samples

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

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": [
    ]
}

EVENT/

Responses

Response samples

Content type
application/json
Example
{
  • "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

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",
  • "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"
]

Get the latest generation

This operation retrieves the latest generation using its id.

Responses

Response samples

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

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
{
  • "schoolYear": "22-23",
  • "roles": [ ]
}

Response samples

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

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": "19-20"
}

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": "19-20"
}

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": "19-09-2023",
  • "lastUpdatedAt": "19-09-2023 16:10:35",
  • "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": "19-09-2023",
  • "lastUpdatedAt": "19-09-2023 16:10:36",
  • "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": ""
}

Response samples

Content type
application/json
Example
{
  • "title": "New Title",
  • "body": "New Body of the post",
  • "thumbnailPath": "https://thumbnails/new.png",
  • "publishDate": "19-09-2023",
  • "lastUpdatedAt": "19-09-2023 16:10:36",
  • "id": 1,
  • "slug": "new-test-released"
}

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": "19-09-2023",
  • "lastUpdatedAt": "19-09-2023 16:10:36",
  • "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/UpdateProject/should fail if the project does not exist

Responses

Response samples

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

PROJECT/

Responses

Response samples

Content type
application/json
Example
{
  • "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",
  • "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 on a specified generation, 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": "TestRole",
  • "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-id486549215)

Responses

Request samples

Content type
application/json;charset=UTF-8
Example
{
  • "name": "Coordenador de Projetos",
  • "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-id486549215)

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-id486549215)

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": 1234
}

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
{ }