GET /infoReturns list with all available endpoints.
Example:
[
"GET /time",
"GET /ip",
"GET /mirror",
"PATCH /mirror",
"POST /mirror",
"PUT /mirror",
"GET /info",
"POST /login",
"GET /secret",
"GET /checkToken"
]
GET /ipReturns server & client IP as JSON object.
Example:
{
"serverIp": "::ffff:172.17.0.2",
"clientIp": "::ffff:172.17.0.1"
}
GET /timeReturns current time as ISO timestamp.
Example:
{
"time": "2023-12-02T20:59:56.451Z"
}
* /mirrorMirrors any request. Shows all request data in the response.
Request:
GET /mirror HTTP/1.1
Host: 127.0.0.1:3000
Response:
{
"method": "GET",
"url": "/mirror",
"headers": {
"user-agent": "PostmanRuntime/7.35.0",
"accept": "*/*",
"cache-control": "no-cache",
"postman-token": "80854cc7-0b1a-467a-93af-1f50b615e166",
"host": "127.0.0.1:3000",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive"
},
"payload": {}
}
Request:
POST /mirror HTTP/1.1
Host: 127.0.0.1:3000
Content-Type: application/json
Content-Length: 42
{"username": "admin", "password": "admin"}
Response:
{
"method": "POST",
"url": "/mirror",
"headers": {
"content-type": "application/json",
"user-agent": "PostmanRuntime/7.35.0",
"accept": "*/*",
"cache-control": "no-cache",
"postman-token": "26a46e6c-6858-45e9-88e5-43d6e7a630e4",
"host": "127.0.0.1:3000",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive",
"content-length": "42"
},
"payload": {
"username": "admin",
"password": "admin"
}
}
Simulates login action, returns JWT key as the response.
Implemented authorization types:
x-username & x-password headersusername & passwordExample:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNzAxNTQ5NzU2LCJleHAiOjE3MDE1NDk4MTZ9.Y-3k6hRyVfZ5hh1Z_92gZHd503YxptwT-KmpQb7Gztw"
}
Simulates protected endpoint. Can be accessible with one of authorization types:
x-username & x-password headersusername & passwordPOST /loginResponse:
{
"secretData": "This is the secret data!"
}
GET /checkTokenShows JWT token details (takes token from authorization header)
Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWF0IjoxNzAxNTQ5NzU2LCJleHAiOjE3MDE1NDk4MTZ9.Y-3k6hRyVfZ5hh1Z_92gZHd503YxptwT-KmpQb7Gztw",
"username": "admin",
"iat": 1701549715,
"exp": 1701549775
}
GET /redirectSimulates HTTP 301 redirect. New URL is GET /time
GET /usersShows list of all registered users.
Query params adds support for search, sorting and hidden options:
id - lookupfirstName - case insensitive lookuplastName - case insensitive lookupstatus - lookupregistrationDateFrom - date range lookupregistrationDateTo - date range lookupaddressStreet - case insensitive lookupsortBy - ascending sort by given field namelimit - limits results sizeshowAddress - shows addresses hidden by default in this viewSends additional headers in response:
X-Total-Count - total number of results (before filtering)X-Filtered-Count - total number of results (after filtering)[
{
"id": 1,
"firstName": "Piotr",
"lastName": "Nowak",
"registrationDate": "2023-10-17T09:55:21.845Z",
"status": "Active"
},
{
"id": 2,
"firstName": "Anna",
"lastName": "Kowalska",
"registrationDate": "2023-07-29T03:33:42.954Z",
"status": "Pending"
}
]
POST /userAdds new user. Request schema:
{
"firstName": "<required>",
"lastName": "<required>",
"address": {
"street": "<required>",
"city": "<required>",
"zipCode": "<required>"
}
}
Response:
{
"userId": 21
}
PUT /user/:userIdOverrides existing user data. Request schema:
{
"firstName": "<required>",
"lastName": "<required>",
"address": {
"street": "<required>",
"city": "<required>",
"zipCode": "<required>"
}
}
Response: new user data, same as for GET /users/:userId
PATCH /user/:userIdOverrides part of user data. Request schema:
{
"firstName": "<optional>",
"lastName": "<optional>",
"address": {
"street": "<optional>",
"city": "<optional>",
"zipCode": "<optional>"
}
}
Response: new user data, same as for GET /users/:userId
GET /user/:userIdShows user details.
{
"id": 21,
"firstName": "Sophia",
"lastName": "Reichert",
"registrationDate": "2023-12-05T19:42:43.336Z",
"status": "Pending",
"address": {
"street": "086 Lucy Valleys",
"city": "Schulistland",
"zipCode": "36-567"
}
}
DELETE /users/:idMarks user with given id as Deleted (soft deletion).
DELETE /users/:id?permanent=trueDeletes user with given id (hard deletion).