Skip to content

API Documentation

Shidan Javaheri edited this page May 24, 2023 · 10 revisions

Behold: our API documentation! πŸ“š Click on each endpoint to see more information. All API documenation follows the following format:

Class Name πŸ›οΈ

GET/POST/PUT/DELETE: /pathToEndpoint

Description

Description of what endpoint does

Parameters

type parameter description of parameter

Return Values

{ 
"id": "String",
"message": "String",
"additionalContact": "String",
"status": "Status" 
} 

Account πŸ”’

POST: /api/account

Description

Allows a user to create an account. Must be logged in with an account with Authority 'Server' to access it.

Parameters

AccoutDto the account DTO object

Return Values

An account Dto object

{
    "username": "String",
    "password": "String",
    "firstname": "String",
    "lastname": "String"
}

Item πŸ“–

POST: /api/item

Description

Allows users to create an item they are trying to memorize / have already memorized

Parameters

Item An item DTO, with only certain fields necessary

{
    "name": "String",
    "words": "String",
    "itemType": "ItemType",
    "favorite": boolean,
    "learnt": boolean,
    "themeIds": list,
    "source": SourceDTO { 
        "id": "String",
        "title": "String",
        "description": "String",
        "author": "String"
    }
}

Return Values

An item DTO

{
    "name": "String",
    "words": "String",
    "dateCreated": "Date",
    "dateLastRevised" : "Date",
    "itemType": "ItemType",
    "favorite": boolean,
    "learnt": boolean,
    "username": "String",
    "themeIds": list,
    "practiceSessions": null,
    "source": SourceDTO { 
        "id": "String",
        "title": "String",
        "description": "String",
        "author": "String"
    }
}

GET: /api/item

Description

Allows users to get all the items associated with their account, and filter them appropriately

Parameters

Filter A FilterDTO, with no feilds necessary ( all nullable ). Returns the items associated with the account that sent the request.

{
    "name": "String",
    "itemType": "String",
    "themeName": "String",
    "words": "String",
    "favorite": boolean
}

Return Values

An Array list of item DTOs

{
    "name": "String",
    "words": "String",
    "dateCreated": "Date",
    "dateLastRevised" : "Date",
    "itemType": "ItemType",
    "favorite": boolean,
    "learnt": boolean,
    "username": "String",
    "themeIds": list,
    "practiceSessions": null,
    "source": SourceDTO { 
        "id": "String",
        "title": "String",
        "description": "String",
        "author": "String"
    }
}

Login πŸŒ€

POST: /api/login

Description

Returns a valid JWT token if the user is properly authenticated

Parameters

AccountDTO An account DTO containing the accounts username and password only

{
    "username": "String",
    "password": "String",
    "firstname": "String",
    "lastname": "String"
}

Return Values

A valid JWT token

GET: /api/login

Description

Returns an account DTO if the token the user has is valid

Parameters

AccountDTO An account DTO containing the account's information

{
    "username": "String",
    "password": null,
    "firstname": "String",
    "lastname": "String"
}

Return Values

A valid JWT token

Theme 🌻

POST: /api/theme?name="String"

Description

Creates a theme associated to the account sending the request

Parameters

name a url parameter, the name of the string

Return Values

A response entity with a String confirmation message of creation