HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Quote API handlers

This topic describes how to add a collection of quote lines for the found cart/customer order.

HTTP Verb: POST

URL: /api/v1/quotes

Description: Add a collection of quote lines for the found cart/customer order

Base: HandlerBase<AddQuoteParameter, AddQuoteResult>

Handlers:

OrderHandlerDescription
500AddQuoteHandlerCalls UpdateQuoteHandler…with a status of QuoteRequestedStatus
OrderHandlerDescription
500AddQuoteAdd a quote using the UpdateQuoteHandlerhandler chain. The added quote is stored in the GetQuoteResult property in the result object.

HTTP Verb: POST

URL: /api/v1/quotes/{quoteId}/messages

Description: Posts the specified RFQ message parameter.

Base: HandlerBase<AddQuoteMessageParameter, AddQuoteMessageResult>

Handlers:

OrderHandlerDescription
500AddQuoteMessageAdd a quote message using the AddMessageHandlerhandler chain. The added message is stored in the MessageAudit property on the result object. This will be obsolete as of version 4.5 and will be moved to the Messages handler.

HTTP Verb: GET

URL: /api/v1/quotes

Description: Returns all customer orders with quote statuses

Base: HandlerBase<GetQuoteCollectionParameter, GetQuoteCollectionResult>

Handlers:

OrderHandlerDescription
500GetQuoteCollectionHandlerGets all the current customer orders with quote statuses on them using the passed in filters.
OrderHandlerDescription
500CreateQueryRetrieves a salesperson by current user profile id and stored it in the CurrentSalesperson property on the result object. Creates the initial quotes query that returns quotes (CustomerOrder) and applies filtering by quote Type and Status. The query is stored in the QuotesQuery property in the result object.
600ApplyFilteringApplies additional filters to the QuotesQuery.

If QuoteNumber parameter has a value, then filter QuotesQuery by QuoteNumber parameterFilter QuotesQuery by SalespersonId propertyFilter QuotesQuery by PlacedByUserProfileId property (should equal UserProfileId if this parameter is not empty, otherwise should equal the current user id if CurrentSalesperson result property has no value)Filter QuotesQuery by CustomerId property (should equal CustomerId if this parameter is not empty, otherwise should equal the current BillTo id if CurrentSalesperson result property has no value)If FromDate parameter has a value, then filter QuotesQuery by FromDate parameterIf ToDate parameter has a value, then filter QuotesQuery by ToDate parameterIf ExpireFromDate parameter has a value, then filter QuotesQuery by ExpireFromDate parameter, otherwise by current dateIf ExpireToDate parameter has a value, then filter QuotesQuery by ExpireToDate parameter
700ExecuteQueryExecutes the QuotesQuery after the query has been filtered and expanded. The result is stored in the QuoteCollection property on the result object.
800ApplySortApplies a sort to the QuoteCollection. The quotes that require action and are more urgent will display first.
900ApplyPagingApplies paging to the QuoteCollection. If the PageSize property on the parameter object has a value, the query is paged using the PageSize and Page properties on the parameter object.
1000GetSalespersonsIf CurrentSalesperson property from result object has a value and GetSalespersonList parameter is true, retrieves a salespersons where SalesManagerId equal the id from CurrentSalesperson property. The result is stored in the SalespersonList property on the result object.

HTTP Verb: GET

URL: /api/v1/quotes/{quoteid:guid}

Description: Return a collection of quote lines for the found cart/customer order

Base: HandlerBase<GetQuoteParameter, GetQuoteResult>

Handlers:

OrderHandlerDescription
500GetQuoteHandlerIf user cannot view quotes, then RfqAccessDenied error result is returned. Gets the cart for the matching quoteid, if a cart is not found then a CartServiceCartNotFound error result is returned. Gets all the quote lines for the found cart/cart lines.
OrderHandlerDescription
500GetCartRetrieves a cart using the GetCartHandler handler chain. If a cart is not found or cart has a type not equal "Quote" or "Job", a not found error is returned. If access to cart is denied, an access denied error is returned. The cart is stored in the GetCartResult property in the result object.
600CreateGetQuoteResultMaps GetCartResult property to the result object. Sets IsEditable property in the result object.
700GetMessageCollectionRetrieves a messages using the GetMessageCollectionHandler handler chain. The messages are stored in the MessageCollection property in the result object.
800GetCalculationMethodsIf salesperson has a value returns calculation methods according to RFQ settings ("Display List Price", "Display Customer Price", "Display Unit Cost"). The calculation methods are stored in the CalculationMethods property in the result object.
900GetQuoteLineResultsMaps CartLineResults to the quote line results. The quote line results are stored in the QuoteLineResults property in the result object.
1000CreatePricingRfqsIf CalculationMethods property has a value, retrieves a pricing for each quote line result using the GetPricingRfq pipeline.

HTTP Verb: GET

URL: /api/v1/quotes/{quotelineid:guid}

Description: Returns a single quote line

Base: HandlerBase<GetQuoteLineParameter, GetQuoteLineResult>

Handlers:

OrderHandlerDescription
500GetQuoteLineHandlerIf user cannot view quotes, then RfqAccessDenied error result is returned. Gets the quote line found from the passed in quotelineid parameter.
500GetQuoteLineRetrieves a quote using the GetQuoteHandlerhandler chain and then retrieves a quote line from this quote by QuoteLineId parameter. The qoute line is stored in the result object.

HTTP Verb: PATCH

URL: /api/v1/quotes/{quoteid:guid}

Description: Updates a quote for the found cart/customer order

Base: HandlerBase<UpdateQuoteParameter, UpdateQuoteResult>

Handlers:

OrderHandlerDescription
500UpdateQuoteHandlerIf parameter status is QuoteRequested, QuoteProposed or JobAccpeted, then calls the next handler. Otherwise, gets the quote based on the quoteid, if no cart/customer order is found for that quoteid, then Not Found error result is returned. Otherwise, the quote is updated with the passed in values, then next handler is called.
550UpdateQuoteStatusHandlerIf parameter status is QuoteRequested, QuoteProposed or JobAccpeted, then the cart/customer order is updated with the quote parameter values. Otherwise, next handler is called.
600UpdateQuoteSendEmailHandlerIf the parameter has no status value, then the next handler is called. If quote doesn't exist or user profile does not exist, then RfqServiceQuoteNotFound error result is returned. Otherwise and email is sent with the found quote information.
650UpdateQuoteAddMessageHandlerIf the parameter has no status value, then the next handler is called. If quote doesn't exist or user profile does not exist, then RfqServiceQuoteNotFound error result is returned. If the status is not "requested", "proposed", "declined", or "submitted" then next handler is called. Otherwise, adds a new Message for the quote.
700UpdateQuotePricesHandlerIf there is no calculation method or percent parameter, then next handler is called. Gets the salesperson associated to the user, if no salesperson exists, then calls next handler. Salesperson pricing/discount values are checked against the parameter values, if they don't validate then an RfqServiceInvalidDiscount error result is returned. Otherwise new quoted prices are added/updated for each found order line.
OrderHandlerDescription
500UpdateQuoteIf Status parameter is not equal to "QuoteRequested", "QuoteProposed" and "JobAccepted", then retrieves a quote using the GetQuoteHandlerhandler chain. If the quote was not found, an error is returned. Updates Status, Type and CustomerReference1 properties in the quote object. The quote object is stored in the GetQuoteResult property in the result object.
600UpdateStatusIf Status parameter is equal to "QuoteRequested", "QuoteProposed" or "JobAccepted", then updates a quote using the UpdateCartHandlerhandler chain. Then retrieves a quote using the GetQuoteHandler handler chain. The quote object is stored in the GetQuoteResult property in the result object.
700UpdateExpirationDateIf ExpirationDate parameter has a value, then updates QuoteExpirationDate quote property to ExpirationDate parameter value.
800PopulateEmailModelIf Status parameter is blank, then bypasses this handler. If PlacedByUserProfile quote property has no value, then a not found error is returned. Otherwise populate an email model. The email model object is stored in the EmailModel property in the result object.
900SendEmailIf Status parameter is blank or EmailModel property has no value, then bypasses this handler. Sends the email.
1000CalculatePricesIf CalculationMethod or Percent parameters has no values, then bypasses this handler. Retrieves a salesperson. If salesperson was not found, then bypasses this handler. Calculates and updates quote lines prices. Retrieves a quote using the GetQuoteHandlerhandler chain. The quote object is stored in the GetQuoteResult property in the result object.
1100AddMessageIf Status parameter is blank, then bypasses this handler. If PlacedByUserProfile quote property has no value, then a not found error is returned. Retrieves a user to add message. Adds a quote message using the AddQuoteMessageHandlerhandler chain.

HTTP Verb: PATCH

URL: /api/v1/quotes/{quotelineid:guid}

Description: Updates a single quote line

Base: HandlerBase<UpdateQuoteLineParameter, UpdateQuoteLineResult>

Handlers:

OrderHandlerDescription
500UpdateQuoteLineHandlerIf user cannot view quotes, then RfqAccessDenied error result is returned. If no quote line is found, then returns RfqServiceQuoteLineNotFound. Updates the quote line found from the passed in quotelineid parameter.
OrderHandlerDescription
500GetQuoteLineRetrieves a quote line using QuoteLineDto.OrderLineId parameter. If the quote line was not found, a not found error is returned. The quote line entity is stored in the QuoteLine property in the result object. Then retrieves a quote line using the GetQuoteLineHandler handler chain. This quote line object is stored in the GetQuoteLineResult property in the result object.
600UpdateQtyOrderedIf QtyOrdered parameter has no value, then bypasses this handler. If rounded quantity is greater then MaxQty, then an error is returned. Updates the quote line quantity ordered. Recalculates a quote line pricing using GetCartPricing pipeline.
700CalculatePricesIf PricingRfq parameter has no value, then bypasses this handler. Retrieves a salesperson. If salesperson was not found, then bypasses this handler. If any price from PricingRfq.PriceBreaks parameter is less then MinimumPriceAllowed, then an error is returned. Creates OrderLineRfq entity if it doesn't exists in QuoteLine property in the result object. Calculate quote line pricing using GetCartPricing pipeline. Retrieves a quote line using the GetQuoteLineHandler handler chain. The quote line object is stored in the GetQuoteLineResult property in the result object.

HTTP Verb: DELETE

URL: /api/v1/quotes/{quoteId}

Description: Deletes the quote for the specified quote identifier.

Base: HandlerBase<RemoveQuoteParameter, RemoveQuoteResult>

Handlers:

OrderHandlerDescription
500GetQuoteRetrieves a quote using the GetQuoteHandlerhandler chain. The quote object is stored in the GetQuoteResult property in the result object.
600RemoveQuoteIf IsSalesperson property in GetQuoteResult object is false, returns an access denied error. Otherwise removes the quote.

Did this page help you?