Messages
Describes the Messages API handler in Optimizely Configured Commerce.
HTTP Verb – GET
URL – /api/v1/messages
Description – Return a collection messages
Handlers –
Base – HandlerBase<GetMessageCollectionParameter, GetMessageCollectionResult>
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 | 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 | 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