MDM NEW
Handle Notifications
Function: handle_notifications Type: API Endpoint (POST)
Purpose: This endpoint handles different types of notifications such as fetching notifications, setting read status, clearing notifications, etc.
URL: POST /api/notifications
Request Parameters:
- App_Code (Header, required): Encoded application code.
- User_Code (Header, required): Encoded user code.
- Customer_Key (Header, required): Encoded customer key.
- data (JSON, required): Data containing the type of notification action and other relevant details.
Process:
- Decodes the Customer_Key to extract lscode and firmcode.
- Validates the customer key.
- Handles different types of notifications based on the data.type parameter:
- getNotifications: Fetches all notifications for the user and returns them in a JSON response.
- setReadStatus: Updates the status of a notification to 'read' (1).
- clearone: Updates the status of a notification to 'cleared' (2).
- setAllReadStatus: Updates the status of all notifications for the user to 'read' (1).
- clearAll: Updates the status of all notifications for the user to 'cleared' (2).
Request Body:
-
For Listing Notifications or Getting Count:
-
type (string, required): Type of notification action (e.g., getNotifications, getCount).
{
"type": "<type>"
}
-
For Status Updations:
-
type (string, required): Type of notification action (e.g., setReadStatus, clearone, setAllReadStatus, clearAll).
-
id (integer, optional): ID of the notification to be updated.
{
"type": "<type>",
"id": <id>
}
- For create or update notofications:
{
"flag": 0 | 1,
"values": {
"application_code": "<application_code>",
"LSCode": "<LSCode>",
"firm_code": "<firm_code>",
"Id": "<Id>",
"Trigger_Type": <Trigger_Type>,
"Status": <Status>,
"Action": <Action>,
"Created_User": "<Created_User>",
"Date_Of_Creation": "<Date_Of_Creation>",
"Modified_User": "<Modified_User>",
"Date_Of_Modification": "<Date_Of_Modification>",
"Parameter": "<Parameter>",
"Message": "<Message>",
"Button_Name_1": "<Button_Name_1>",
"Button_Value_1": "<Button_Value_1>",
"Button_Name_2": "<Button_Name_2>",
"Button_Value_2": "<Button_Value_2>",
"Button_Name_3": "<Button_Name_3>",
"Button_Value_3": "<Button_Value_3>",
"Icon": "<Icon>",
"Body_Image": "<Body_Image>"
}
}
**Response**:
- JSON response containing the list of notifications or the result of the notification action.
- Indicates success or failure for each step, including any errors encountered.
**Exceptions**:
- Handles exceptions related to database operations and invalid customer key formats, providing appropriate error messages.
post/api/new_mdm/notifications
Headers
App-Codestring required
User-Codestring required
Customer-Keystring required
Request body
Response
Successful Response
{"stackTrail":"paths:/api/new_mdm/notifications:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}
Changes
No recorded changes to this endpoint across all 1 revision of this API.