Messages API handler
Return a collection of messages.
HTTP Verb – GET
URL – /api/v1/messages
Description – Return a collection messages
Base – HandlerBase<GetMessageCollectionParameter, GetMessageCollectionResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | GetMessageCollectionHandler | If no logged in user is found, then a Forbidden error result is returned. Otherwise gets all messages with a DateToDisplay that is less than the current date and either has no DateToHide or DateToHide is greater than current date and language is the same as the current language. Also filters by removing any messages that don't have MessageTargets target types for "WebSite", "Customer", "CustomerType", "UserProfile" and user profile "Role" where the TargetKey's don't match the current Id's of those values. |
Order | Handler | Description |
---|---|---|
500 | GetMessagesQuery | If UserProfile object has no value, a forbidden error is returned. Creates the messages query and stores it in the MessageQuery property in the result object. Creates the message statuses query and stores it in the MessageStatusQuery property in the result object. |
600 | GetMessagesForCustomerOrder | If CustomerOrderId parameter has no value, then bypasses this handler. If customer order was nor found by CustomerOrderId parameter, then a not found error is returned. Validates CustomerOrder properties. Applies additional filters to MessageQuery using CustomerOrderId parameter. Executes the MessageQuery and MessageStatusQuery. By each message id retrieves message using GetMessageHandler handler chain. The messages are stored in the GetMessageResults property in the result object. |
700 | GetMessageCollectionResult | If CustomerOrderId parameter has value or MessageQuery didn't return any messages, then bypasses this handler. Executes the MessageQuery and MessageStatusQuery. By each message id retrieves message using GetMessageHandler handler chain. The messages are stored in the GetMessageResults property in the result object. |
HTTP Verb – GET
URL – /api/v1/messages/{messageid:guid}
Description – Return a message record
Base – HandlerBase<GetMessageParameter, GetMessageResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | GetMessageHandler | Same as above, but just gets the message for the matching messageid. If the found message is not connected with the current "WebSite", "Customer", "CustomerType", "UserProfile" or user profile "Role", then a Not Found error message is returned. |
Order | Handler | Description |
---|---|---|
500 | ValidateMessage | If SkipValidation parameter is true, then stores Message parameter in the MessageObject property in the result object and bypasses this handler. If UserProfile is null, then a forbidden error is returned. Validates the message and stores it in the MessageObject property in the result object. |
600 | GetMessage | Creates MessageDto object by MessageObject and MessageStatuses parameter. The MessageDto object is stored in the MessageDto property in the result object. |
HTTP Verb – POST
URL – /api/v1/messages
Description – Adds a message record.
Base – HandlerBase<AddMessageParameter, AddMessageResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | CreateMessage | If UserProfile object has no value, a forbidden error is returned. Creates a message and stores it in the MessageObject property in the result object. |
600 | CreateMessageTarget | Creates a MessageTarget and add it to the MessageObject.MessageTargets result property. Creates a MessageStatus and add it to the MessageObject.MessageStatuses result property. |
700 | CreateMessageAudit | Creates a MessageAudit and add it to the MessageObject.MessageAudits result property. |
HTTP Verb – PATCH
URL – /api/v1/messages/{messageid:guid}
Description – Updates a single message record
Base – HandlerBase<UpdateMessageParameter, UpdateMessageResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | UpdateMessageHandler | If no logged in user is found, then a Forbidden error result is returned. If no matching message record is found, then Not Found error message is returned. Otherwise updates the message for the messageid. |
Order | Handler | Description |
---|---|---|
500 | ValidateMessage | If UserProfile is null, then a forbidden error is returned. Retrieves a message by MessageId parameter. The message is stored in the MessageObject property in the result object. The MessageId parameter value is stored in the MessageId property in the result object. |
600 | UpdateMessageStatus | If IsRead parameter has no value, then bypasses this handler. Retrieves MessageStatus entity or creates new MessageStatus entity if it doesn't exist. Update HasRead property value in MessageStatus entity. Sets HasRead property in the result object to MessageStatus.HasRead value. |
Updated over 1 year ago