Activity Routes
This page provides routes for managing activities. The following routes are available:
GET /user
Retrieves the activities for the authenticated user.
Description: This endpoint retrieves the activities for the authenticated user.
Authentication: This route requires authentication with the USER role and the read permission.
Parameters: None
Response:
- Success Response (200 OK):
json
[
{
"_id": "667e56bb8ada0eae284b21c1",
"activityType": "create-user",
"context": "User with id: 667e52015767249ca5838bfa created local user with id: 667e56bbd9d7b18a0c696585",
"createdBy": "667e52015767249ca5838bfa",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-28T06:22:51.812Z",
"updatedAt": "2024-06-28T06:22:51.812Z",
"__v": 0
},
{
"_id": "667e56f98ada0eae284b21c9",
"activityType": "create-role",
"context": "Created new role: Test Role",
"createdBy": "667e52015767249ca5838bfa",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-28T06:23:53.555Z",
"updatedAt": "2024-06-28T06:23:53.555Z",
"__v": 0
}
]Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure400 Bad Request:Activities not found for the requested user.
Usage: To retrieve the activities for the authenticated user, send a GET request to /user.
GET /queries
Retrieves activities based on a query.
Description: This endpoint retrieves activities based on a specified query.
Authentication: This route requires authentication with the OWNER or ADMIN role and the read permission.
Parameters: None
Response:
- Success Response (200 OK):
json
{
"limit": 10,
"page": 1,
"results": [
{
"_id": "6671318955cb98356d9a15ae",
"activityType": "create-role",
"context": "Created new role: MANAGER",
"createdBy": "66605eaedd7f7aae27752dda",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-18T07:04:41.497Z",
"updatedAt": "2024-06-18T07:04:41.497Z",
"__v": 0
},
{
"_id": "6671375c6ccf7cd2a5196867",
"activityType": "create-role",
"context": "Created new role: MANAGER",
"createdBy": "66605eaedd7f7aae27752dda",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-18T07:29:32.879Z",
"updatedAt": "2024-06-18T07:29:32.879Z",
"__v": 0
},
{
"_id": "667e56f98ada0eae284b21c9",
"activityType": "create-role",
"context": "Created new role: Test Role",
"createdBy": "667e52015767249ca5838bfa",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-28T06:23:53.555Z",
"updatedAt": "2024-06-28T06:23:53.555Z",
"__v": 0
}
],
"totalPages": 1,
"totalResults": 3
}Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure400 Bad Request:Activities not found for the requested user.
Usage: To retrieve activities based on a query, send a GET request to /queries.
GET /user/:userId
Retrieves activities for a specific user.
Description: This endpoint retrieves activities for a specific user based on the provided user ID.
Authentication: This route requires authentication with the OWNER or ADMIN role and the read permission.
Parameters:
userId(required): The ID of the user to retrieve activities for.
Response:
- Success Response (200 OK):
json
[
{
"_id": "667e56bb8ada0eae284b21c1",
"activityType": "create-user",
"context": "User with id: 667e52015767249ca5838bfa created local user with id: 667e56bbd9d7b18a0c696585",
"createdBy": "667e52015767249ca5838bfa",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-28T06:22:51.812Z",
"updatedAt": "2024-06-28T06:22:51.812Z",
"__v": 0
},
{
"_id": "667e56f98ada0eae284b21c9",
"activityType": "create-role",
"context": "Created new role: Test Role",
"createdBy": "667e52015767249ca5838bfa",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-28T06:23:53.555Z",
"updatedAt": "2024-06-28T06:23:53.555Z",
"__v": 0
}
]Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure404 Not Found:Returned when the user with the specified ID is not found.
Usage: To retrieve activities for a specific user, send a GET request to /user/:userId, replacing :userId with the ID of the user you want to retrieve activities for.
GET /tags/:tag
Retrieves activities by tag.
Description: This endpoint retrieves activities based on the provided tag.
Authentication: This route requires authentication with the OWNER or ADMIN role and the read permission.
Parameters:
tag(required): The tag to filter activities by.
Response:
- Success Response (200 OK):
json
[
{
"_id": "6666cb1dc4c57443a073c6a9",
"activityType": "update-organization",
"context": "Updated:acronym:NN3",
"createdBy": "66605eaedd7f7aae27752dda",
"organizationId": "666141dbfe2a0781e76f6549",
"tags": ["acronym"],
"createdAt": "2024-06-10T09:45:01.665Z",
"updatedAt": "2024-06-10T09:45:01.665Z",
"__v": 0
}
]Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure400 Not Found:Returned when the activities with the specified tag is not found.
Usage: To retrieve activities by tag, send a GET request to /tags/:tag, replacing :tag with the tag you want to filter activities by.
GET /organization/:orgId
Retrieves activities for a specific organization.
Description: This endpoint retrieves activities for a specific organization based on the provided organization ID.
Authentication: This route requires authentication with the OWNER or ADMIN role and the read permission.
Parameters:
orgId(required): The ID of the organization to retrieve activities for.
Response:
- Success Response (200 OK):
json
[
{
"_id": "667010b9e34b5fe6d45aabb0",
"activityType": "create-user",
"context": "User with id: 66605ceba6b6a8478a0953ea created user with id: 667010b8d14c54c691968cc5",
"createdBy": "66605ceba6b6a8478a0953ea",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-17T10:32:25.632Z",
"updatedAt": "2024-06-17T10:32:25.632Z",
"__v": 0
},
{
"_id": "667010c4e34b5fe6d45aabb5",
"activityType": "create-user",
"context": "User with id: 66605ceba6b6a8478a0953ea created user with id: 667010c3d14c54c691968cce",
"createdBy": "66605ceba6b6a8478a0953ea",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-17T10:32:36.754Z",
"updatedAt": "2024-06-17T10:32:36.754Z",
"__v": 0
},
{
"_id": "667010e2e34b5fe6d45aabba",
"activityType": "create-user",
"context": "User with id: 66605ceba6b6a8478a0953ea created user with id: 667010e1d14c54c691968cd7",
"createdBy": "66605ceba6b6a8478a0953ea",
"orgId": "666141dbfe2a0781e76f6549",
"tags": [],
"createdAt": "2024-06-17T10:33:06.571Z",
"updatedAt": "2024-06-17T10:33:06.571Z",
"__v": 0
}
]Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure404 Not Found:Returned when the organization with the specified ID is not found.
Usage: To retrieve activities for a specific organization, send a GET request to /organization/:orgId, replacing :orgId with the ID of the organization you want to retrieve activities for.
GET /:id
Retrieves a specific activity by ID.
Description: This endpoint retrieves a specific activity based on the provided activity ID.
Authentication: This route requires authentication with the OWNER or ADMIN role and the read permission.
Parameters:
id(required): The ID of the activity to retrieve.
Response:
- Success Response (200 OK):
json
{
"_id": "6666cb1dc4c57443a073c6a9",
"activityType": "update-organization",
"context": "Updated:acronym:NN3",
"createdBy": "66605eaedd7f7aae27752dda",
"organizationId": "666141dbfe2a0781e76f6549",
"tags": ["acronym"],
"createdAt": "2024-06-10T09:45:01.665Z",
"updatedAt": "2024-06-10T09:45:01.665Z",
"__v": 0
}Errors:
500 Internal Server Error:Errors may occur due to authentication failure, request body validation failure404 Not Found:Returned when the activity with the specified ID is not found.
Usage: To retrieve a specific activity, send a GET request to /:id, replacing :id with the ID of the activity you want to retrieve.