edited api docs
This commit is contained in:
@@ -14,17 +14,17 @@ Service status: https://status.the1s.de
|
|||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
All protected endpoints (except `/api/all-items`) require an API key as a path parameter `:key`.
|
All endpoints require an API key as a path parameter `:key`.
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
|
|
||||||
- Exactly 15 characters
|
- Exactly 8 characters
|
||||||
- Digits only
|
- Digits only
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /api/items/123456789012345
|
GET /api/items/12345678
|
||||||
```
|
```
|
||||||
|
|
||||||
Error if missing/invalid: `401 Unauthorized`.
|
Error if missing/invalid: `401 Unauthorized`.
|
||||||
@@ -52,7 +52,7 @@ Returns all items wrapped in a `data` object.
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
GET https://backend.insta.the1s.de/api/items/123456789012345
|
GET https://backend.insta.the1s.de/api/items/12345678
|
||||||
```
|
```
|
||||||
|
|
||||||
Successful response (example structure; actual columns depend on table):
|
Successful response (example structure; actual columns depend on table):
|
||||||
@@ -90,7 +90,7 @@ Parameters:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
POST https://backend.insta.the1s.de/api/change-state/123456789012345/42/1
|
POST https://backend.insta.the1s.de/api/change-state/12345678/42/1
|
||||||
```
|
```
|
||||||
|
|
||||||
Current success response:
|
Current success response:
|
||||||
@@ -118,7 +118,7 @@ Returns limited loan fields (current implementation selects only: `username, ret
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
GET https://backend.insta.the1s.de/api/get-loan-by-code/123456789012345/646473
|
GET https://backend.insta.the1s.de/api/get-loan-by-code/12345678/646473
|
||||||
```
|
```
|
||||||
|
|
||||||
Response (if found):
|
Response (if found):
|
||||||
@@ -152,7 +152,7 @@ Sets `returned_date = NOW()` for the loan. Also updates all linked items:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
POST https://backend.insta.the1s.de/api/set-return-date/123456789012345/646473
|
POST https://backend.insta.the1s.de/api/set-return-date/12345678/646473
|
||||||
```
|
```
|
||||||
|
|
||||||
Response on success:
|
Response on success:
|
||||||
@@ -178,7 +178,7 @@ Sets `take_date = NOW()` for the loan. Also updates linked items:
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
POST https://backend.insta.the1s.de/api/set-take-date/123456789012345/646473
|
POST https://backend.insta.the1s.de/api/set-take-date/12345678/646473
|
||||||
```
|
```
|
||||||
|
|
||||||
Response on success:
|
Response on success:
|
||||||
|
|||||||
@@ -88,14 +88,4 @@ router.post(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Route for API to get ALL items from the database (only for landingpage)
|
|
||||||
router.get("/all-items", async (req, res) => {
|
|
||||||
const result = await getItemsFromDatabaseV2();
|
|
||||||
if (result.success) {
|
|
||||||
res.status(200).json(result.data);
|
|
||||||
} else {
|
|
||||||
res.status(500).json({ message: "Failed to fetch items" });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
Reference in New Issue
Block a user