Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

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>

OrderHandlerDescription
500GetMessagesQueryIf 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.
600GetMessagesForCustomerOrderIf 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.
700GetMessageCollectionResultIf 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 –

OrderHandlerDescription
500ValidateMessageIf 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.
600GetMessageCreates 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 –

OrderHandlerDescription
500CreateMessageIf UserProfile object has no value, a forbidden error is returned. Creates a message and stores it in the MessageObject property in the result object.
600CreateMessageTargetCreates a MessageTarget and add it to the MessageObject.MessageTargets result property. Creates a MessageStatus and add it to the MessageObject.MessageStatuses result property.
700CreateMessageAuditCreates 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 –

OrderHandlerDescription
500ValidateMessageIf 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.
600UpdateMessageStatusIf 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.