Welcome to the FIGURAniS API documentation! This API serves as the backend for the FIGURAniS project, allowing users to manage their anime figure collection. The API provides endpoints for user authentication and retrieving figure data from a MongoDB database. To ensure security, authentication is required to access the figure-related endpoints, and users can only retrieve figures associated with their user ID.
-
Endpoint: POST /user/login
-
This endpoint is used to log in a user and obtain an authentication token.
{
"username": admin,
"password": admin
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4OTA4MDk4MDk4MDk4MDk4IiwibmFtZSI6ImlzZGljb3VkYWhzIiwiaWF0IjoxNjg0MTUxNzEwLCJleHAiOjE2ODQyMzgxMTB9.8nONfhY3flP0sw2T1251a6freHSEb1eF4hRcSiA9gyA"
}
Note: The obtained token must be included in the Authorization header of subsequent requests as a Bearer token.
-
Endpoint: GET /figures
- This endpoint retrieves all the figures associated with the authenticated user.
Authorization: Bearer <token>
{
"figures": [
{
"_id": "614c5ec9a5207e001f6ffabc",
"title": "Figure 1",
"character": "Character 1",
"franchise": "Franchise 1",
"isPurchased": true,
"manufacturer": "Manufacturer 1",
"material": "Material 1",
"size": 10,
"weight": 0.5,
"price": 100,
"image": "https:/discord/image1.jpg"
},
{
"_id": "614c5ed8a5207e001f6ffabd",
"title": "Figure 2",
"character": "Character 2",
"franchise": "Franchise 2",
"isPurchased": false,
"manufacturer": "Manufacturer 2",
"material": "Material 2",
"size": 15,
"weight": 0.7,
"price": 150,
"image": "https:/discord/image2.jpg"
}
],
"length": 2
}
-
Endpoint: GET /figures/:id
- This endpoint retrieves a specific figure by its ID. Only figures associated with the authenticated user can be accessed.
Authorization: Bearer <token>
{
"figure": {
"title": "Jimei Palace Enel the god of thunder One Piece",
"character": "Enel",
"franchise": "One Piece",
"isPurchased": true,
"manufacturer": "Jimei Palace",
"material": "Resin + LED",
"size": 62,
"weight": 9.87,
"price": 1599,
"image": "https://i.ibb.co/5Mv33z5/enel.webp",
"user": "646fc50910c8e8c5b17d54a7",
"id": "6489adcd75f15c7f21954b8b"
}
}
-
Endpoint: DELETE /figures/delete/:id
- This endpoint deletes a specific figure by its ID. Only figures associated with the authenticated user can be deleted.
Authorization: Bearer <token>
{
"message": "The figure has been removed"
}
-
Endpoint: PUT /figures/:id
- This endpoint updates a specific figure by its ID. Only figures associated with the authenticated user can be updated.
Authorization: Bearer <token>
{
"title": "Updated Figure",
"character": "Updated Character",
"franchise": "Updated Franchise",
"isPurchased": true,
"manufacturer": "Updated Manufacturer",
"material": "Updated Material",
"size": 20,
"weight": 1.2,
"price": 200,
"image": "https:/discord/updated-image.jpg"
}
{
"message": "The figure could not be updated"
}
-
Endpoint: PUT /figures/:id
- This endpoint adds a specific figure by sending it in the body. It will be added in the database associated to the user.
Authorization: Bearer <token>
{
"title": "Dragon Ball Fat Buu BT Studio",
"character": "Fat Buu",
"franchise": "Dragon Ball",
"isPurchased": false,
"manufacturer": "BT Studio",
"material": "Resin",
"size": 30,
"weight": 2.87,
"price": 205.4,
"image": "https://i.ibb.co/rsWcdcc/fat-boo-dog.webp"
}
{
"figure": {
"user": "646fc50910c8e8c5b17d54a7",
"id": "6490128f5b7e2763363c4d7b",
"title": "Dragon Ball Fat Buu BT Studio",
"character": "Fat Buu",
"franchise": "Dragon Ball",
"isPurchased": false,
"manufacturer": "BT Studio",
"material": "Resin",
"size": 30,
"weight": 2.87,
"price": 205.4,
"image": "https://i.ibb.co/rsWcdcc/fat-boo-dog.webp"
}
}
The FIGURAniS API is built using the following technologies: