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

Wishlist API handler

Add a single wishlist.

HTTP Verb – POST

URL – /api/v1/wishlists

Description – Adds a single wish list

Base – HandlerBase<AddWishListParameter, WishListResult>

Handlers

OrderHandlerDescription
500AddWishListHandlerAdds a wishlist. If requester is not signed in then handler return Forbidden error result. If website configuration value "AllowMultipleWebsites" is "true" but no wishlist name is found, then "WishListServiceNameRequired" error result is returned. If "AllowMultipleWebsites" is "false" and a wishlist name is found but the name is not the default name, then "WishListServiceMultipleNotAllowed" error result is returned. If "AllowMultipleWebsites" is "false" and the name provided does not have a value, then it is set to the default name. If "AllowMultipleWebsites" is "true" only creates a new wishlist if one does not already exist.
OrderHandlerDescription
500ValidateContextCheck UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden

If allow multiple wishlists is true and Name parameter is empty return error (MessageProvider.Current.Lists_List_Name_Required)

If allow multiple wishlists is false, Name property is not equal to DefaultName and not empty, return error MessageProvider.Current.Multiple_Not_Allowed
600AddWishListIf allow multiple wishlists is false, Name property is empty, then use DefaultName.

If allow multiple wishlists is true, filter wishlists by UserProfileDto.Id result value and Name parameter, otherwise get last modified wishlist by UserProfileDto.Id result value. In case when failed to find anything, then create new wishlist and initiate it with context values.
700CreateGetWishListResultGet wishlist using CreateGetWishListResult wishList pipeline and set result to GetWishListResult.

HTTP Verb – POST

URL – /api/v1/wishlists/{wishlistid}/wishlistlines/batch

Description – Add a collection of products to a specific wish list

Base – HandlerBase<AddWishListLineCollectionParameter, WishListResult>

Handlers

OrderHandlerDescription
500AddWishListLineCollectionHandlerAdds a wishlist line to the wishlist. If requester is not signed in then handler return Fobidden error result. If website configuration "Wishlists_ByCustomer" is "true", then gets the wish list for the current bill to and wishlistid, otherwise gets the wishlist for the current requester and wishlistid. If no wishlist is found then handler return error result. Calls next handler.
600AddUpdateWishListLineCollectionHandlerAdds or updates a wishlist line to the wishlist. If the passed in wishlist is not found, then returns a Not Found error result. Iterates through all the passed in wishlist lines. If an existing wishlist line is found, then if the application setting for "Web_ReplaceOnAddToCart" is "true" the quantity value is replaced with the passed in value, otherwise the passed in quantity is added to the existing quantity. If no existing wishlist line is found, then a new one is created.
OrderHandlerDescription
500GetWishListCall GetWishList with WishListId parameter
600GetProductsCall GetProductCollection with IgnoreIsConfigured set to false and ProductIds from AddWishListLineParameterCollection parameter
700AddOrUpdateWishListLineCollectionIf wishlist  AllowEdit property is false and UserProfileDto or RememberedUserProfileDto from site context are not equal to wishlist UserProfileId, then return Forbidden.

Iterate over AddWishListLineParameterCollection parameter, depending on whether WishListProduct already exists or not, update it or add. ReplaceOnAdd setting is controlling what should be done during QtyOrdered property update.

HTTP Verb – POST

URL – /api/v1/wishlists/{wishlistid}/wishlistlines

Description – Add a product to a specific wish list

Base – HandlerBase<AddWishListLineParameter, WishListLineResult>

Handlers

OrderHandlerDescription
500AddWishListLineHandlerAdds a wishlist line to the wishlist. Calls GetWishListHandler, if no wishlist is found then handler returns error result. If no wish list line is found returns Not Found error result. If an existing wishlist line is found, then if the application setting for "Web_ReplaceOnAddToCart" is "true" the quantity value is replaced with the passed in value, otherwise the passed in quantity is added to the existing quantity. If no existing wishlist line is found, then a new one is created.
OrderHandlerDescription
500GetWishListCall GetWishList with WishListId parameter
600GetProductCall GetProduct with ProductId parameter
700AddWishListLineIf wishlist AllowEdit property is false and UserProfileDto or RememberedUserProfileDto from site context are not equal to wishlist UserProfileId, then return Forbidden.

Depending on whether WishListProduct already exists or not, update it or add. ReplaceOnAdd setting is controlling what should be done during QtyOrdered property update.
800CreateGetWishListLineResultCall CreateGetWishListLineResults wishList pipeline with WishListLine result property, if ResultCode was ResultCode.Success, then set first GetWishListLineResults into GetWishListLineResult result property.

HTTP Verb – GET

URL – /api/v1/wishlists/{wishlistId} and /api/v1/wishlists/{wishlistid}/wishlistlines

Description – Return a single wishlist

Base – HandlerBase<GetWishListParameter, WishListResult>

Handlers

OrderHandlerDescription
500GetWishListHandlerGets wishlist. If requester is not signed in then handler return Fobidden error result. If website configuration "Wishlists_ByCustomer" is "true", then gets the wish list for the current bill to and wishlistid (if wishlistid has a value), otherwise gets the wishlist for the current requester and wishlistid (if wishlistid has a value). If no wishlist is found then handler return error result.
OrderHandlerDescription
500GetWishListCall GetWishListCollection with WishListId, ExcludeListLines, GetStaticList and GetHiddenProducts parameter

If number of result wishlists is more then 1 - return NotFound error.

If ExcludeListLines parameter is true, then execute next handler

If GetAllLines parameter is true, then get all WishListProducts, otherwise apply paging

Call CreateGetWishListLineResults wishlist pipeline and set GetWishListLineResults property.
600GetSharedUsersIf GetSharedUsers parameter is false, then execute next handler, otherwise set SharedUsers property. For activated users UserProfile.GetDisplayName() will be called, for others Email will be shown. Only owner can see non-activated WishListShare items.

HTTP Verb – GET

URL – /api/v1/wishlists/{wishlistid}/wishlistlines/{wishlistid}

Description – Return a wish list line for a specific wish list

Base – HandlerBase<GetWishListLineParameter, GetWishListLineResult>

Handlers

OrderHandlerDescription
500GetWishListLineHandlerGets wishlist line for the specified wishlist. Calls GetWishListHandler with the provided wishlistid. If and error result is returned, then returns that error result. If the wishlist line is not found, then a Not Found error result is returned.
OrderHandlerDescription
500GetWishListCalls GetWishList with WishListId parameter and setting GetHiddenProducts to true.
600CreateGetWishListLineResultTries to find WishListProducts with WishListLineId parameter and returns NotFound, if failed.

Calls CreateGetWishListLineResults wishlist pipeline, if nothing was returned in GetWishListLineResults, then executes next handler.

HTTP Verb – GET

URL – /api/v1/wishlists

Description – Returns all wishlists for the logged in user or bill to customer.

Base – HandlerBase<GetWishListCollectionParameter, GetWishListCollectionResult>

Handlers

OrderHandlerDescription
500GetWishListCollectionHandlerGets collection of wishlists. If requester is not signed in then handler return Fobidden error result. If "IncludeWishListLines" parameter value is "true" then the wishlist lines are included. If website configuration "Wishlists_ByCustomer" is "true", then gets all wishlists for the current bill to, otherwise gets all wishlists for the current requester. If website configuration value "AllowMultipleWishLists" is "false" and found wishlists is more than 1, then gets the wish list with the default name of "My Wishlist". If no wishlists are found, then new default wishlist is created.
800GetWishListCollectionPunchOutHandlerSimply calls the next handler.
OrderHandlerDescription
500ValidateContextCheck GetStaticList parameter is false and UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden
600GetWishListQueryCreate WishListQuery query, if IncludeWishListLines parameter is true, then expand Product, ModifiedByUserProfile and WishListShares
700ApplyFilteringIf WishListId parameter has value, then filter WishListQuery by WishListId parameter
If GetStaticList parameter is true, then filter WishListQuery by WishList.ShareOptionType.Static, otherwise by UserProfileDto or WishList.ShareOptionType.AllCustomerUsers or active WishListShares.
730ApplySortSort WishListQuery. See additional information below.
770ApplyPagingApplies paging to the WishListQuery. 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. If the PageSize property has no value, the default page size will be used (configured using the "Number of items that display per page by default." setting).
800ExecuteQuerySorts WishListQuery and executes query. See additional information below.
900SelectDefaultWishListIf allow multiple wishlists setting is false and number of wishlists in result is more then 1 - get last modified wishlist.
1000AddWishlistCreates new wishlist with default name, if allow multiple wishlists is false and there is no wishlists in results and WishListId parameter was empty.
1100CreateGetWishListResultsIterates over WishLists result and call CreateGetWishListResult wishlist pipeline per each wishlist. If IncludeWishListLines parameter is false, then execute next handler, otherwise iterates over GetWishListResults, sorts WishListProducts and calls CreateGetWishListLineResults wishlist pipeline with GetHiddenProducts parameter (this parameter allows to get discontinued, deactivated and restricted products). See additional information below.

 

HTTP Verb – GET

URL – /api/v1/wishlists

Description – Returns all wishlist lines for the logged in user or bill to customer.

Base – HandlerBase<GetWishListLineCollectionParameter, GetWishListLineCollectionResult>

Handlers

OrderHandlerDescription
500GetWishListLineCollectionHandlerGets collection of wishlists. If requester is not signed in then handler return Fobidden error result. If "IncludeWishListLines" parameter value is "true" then the wishlist lines are included. If website configuration "Wishlists_ByCustomer" is "true", then gets all wishlists for the current bill to, otherwise gets all wishlists for the current requester. If website configuration value "AllowMultipleWishLists" is "false" and found wishlists is more than 1, then gets the wish list with the default name of "My Wishlist". If no wishlists are found, then new default wishlist is created.
800GetWishListLineCollectionPunchOutHandlerSimply calls the next handler.
OrderHandlerDescription
500ValidateContextCheck that UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden.
600GetWishListLinesQueryCreate WishListLineQuery query.
700ApplyFilteringFilter WishListLineQuery by WishListId parameter.

If Query is included, filter WishListLineQuery by Product.ShortDescription, Product.ErpNumber or Product.ManufacturerItem contain Query.

Ensure WishListLineQuery filters to only WishListLines available to the current User or current customer.
730ApplySortSorts WishListLineQuery based on the Sort parameter. Available sorts: CreatedOn CreatedOn DESC SortOrder default SortOrder DESC Product.ShortDescription Product.ShortDescription DESC.
770ApplyPagingApplies paging to the WishListLineQuery. 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. If the PageSize property has no value, the default page size will be used (configured using the "Number of items that display per page by default." setting).
800CreateGetWishListLineCollectionResultsExecutes the WishListLineQuery and uses the CreateWishListLineResults pipeline on WishListPipeline to create WishListLineResults.
900SelectDefaultWishListIf allow multiple wishlists setting is false and number of wishlists in result is more then 1 - get last modified wishlist.

Order 730 Sort WishListQuery Specifications

Sort ValueSort Description
"ModifiedOn DESC"Sorts by ModifiedOn property descending
"Name ASC"Sorts by Name property
"Name DESC"Sorts by Name property descending

Order 1100 WishlistLinesSort Specifications

WishListLinesSort valueWishListLinesSort Description
"mostRecent"Sorts by CreatedOn property descending
any other valueSorts by SortOrder property

HTTP Verb – DELETE

URL – /api/v1/wishlists/{wishlistid:guid}

Description – Remove a single wish list.

Base – HandlerBase<RemoveWishListParameter, RemoveWishListResult>

Handlers

OrderHandlerDescription
500RemoveWishListHandlerRemoves a wishlist. Calls, GetWishListHandler, if returns error, then error result is returned.
OrderHandlerDescription
500GetWishListCalls GetWishList with WishListId parameter
600RemoveWishListCheck UserProfileDto or RememberedUserProfileDto id is equals to WishList.UserProfileId from result, otherwise returns Forbidden. Removes result WishList from database.

HTTP Verb – DELETE

URL – /api/v1/wishlists/{wishListId}/wishlistlines/batch

Description – Removes all lines specified from a wish list.

Base –HandlerBase<RemoveWishListLineCollectionParameter, RemoveWishListLineCollectionResult>

OrderHandlerDescription
500GetWishListCalls GetWishList with WishListId parameter and GetHiddenProducts with true value. Then filters GetWishListLineResults with WishListLineIds parameter.
600RemoveWishListLineCollectionChecks if UserProfileDto or RememberedUserProfileDto from site context is not owner and AllowEdit is false, then return Forbidden, otherwise remove lines from database and updates wishlist ModifiedByUserProfileId, ModifiedOn properties.

HTTP Verb – DELETE

URL – /api/v1/wishlists/{wishlistid}/wishlistlines/{wishlistlineid}

Description – Remove a single product from a specific wish list.

Base – HandlerBase<RemoveWishListLineParameter, RemoveWishListLineResult>

Handlers

OrderHandlerDescription
500RemoveWishListLineHandlerRemoves a wishlist line. Calls GetWishListHandler, if no wishlist is found then handler returns error result. If no wish list line is found returns Not Found error result.
OrderHandlerDescription
500GetWishListLineCalls GetWishListLine wishlist service with WishListId and WishListLineId parameters
600RemoveWishListLineChecks if UserProfileDto or RememberedUserProfileDto from site context is not owner and AllowEdit is false, then return Forbidden, otherwise removes line from database and updates wishlist ModifiedByUserProfileId, ModifiedOn properties.

HTTP Verb – DELETE

URL – /api/v1/wishlists/{wishListId}/share/{wishListShareId}

Description – Removes the share request specified.

Base: HandlerBase<RemoveWishListShareParameter, RemoveWishListShareResult>

OrderHandlerDescription
500GetWishListCalls GetWishList wishlist service with WishListId parameter
600RemoveWishListShareChecks if user is not owner and WishListShareId parameter is not null, then return Forbidden, otherwise gets WishListShare filtered by WishListShareId parameter (if not null) or first row for that user and removes it from database, if row was found.

HTTP Verb – PATCH

URL – /api/v1/wishlists/{wishlistid}/wishlistlines/{wishlistlineid:guid}

Description – Update product information such as qty for a specific wish list line

Base – HandlerBase<UpdateWishListLineParameter, UpdateWishListLineResult>

Handlers

OrderHandlerDescription
500UpdateWishListLineHandlerUpdates a wishlist line. Calls GetWishListHandler, if no wishlist is found then handler returns error result. If no wish list line is found returns Not Found error result. If quantity is zero or less than returns an error result.
OrderHandlerDescription
500ValidateQtyIf Qty parameter is less or equals to zero, then return WishListServiceQtyTooSmall with MessageProvider.Current.Quantity_Too_Small message
600GetWishListLineCall GetWishListLine wishlist service with WishListId, WishListLineId parameters
700UpdateWishListLineChecks if wishlist AllowEdit is false and UserProfileDto or RememberedUserProfileDto is not owner from site context, then return Forbidden

If there is any duplicated WishListProduct item, then summarize quantity and remove duplicates

Update line SortOrder, Notes, QtyOrdered and UnitOfMeasure, also update wishlist ModifiedByUserProfileId and ModifiedOn properties.
800CreateGetWishListLineResultCall CreateGetWishListLineResults wishlist pipeline for setting GetWishListLineResult property.

HTTP Verb – PATCH

URL – /api/v1/wishlists/activateinvite

Description – Activates the wishlist for the invite.

Base – HandlerBase<UpdateWishListInviteParameter, UpdateWishListInviteResult>

Handlers

OrderHandlerDescription
500ActivateWishListShareIf Invite parameter is blank, then return BadRequest

Search WishListShare by Invite parameter and expand wishlist, if not found return NotFound.

If owner tries to activate invite return BadRequest, otherwise activate invite, if it wasn't already activated
600GetWishListCall GetWishList wishlist service with WishListId result value.

HTTP Verb – PATCH

URL – /api/v1/wishlists/{wishListId}/sendacopy

Description – Invites a user to a copy of the wishlist.

Base – HandlerBase<UpdateWishListSendACopyParameter, UpdateWishListSendACopyResult>

Handlers

OrderHandlerDescription
500GetWishListCall GetWishList wishlist service with WishListId parameter
600SendACopyIf SenderName parameter is empty return BadRequest

If RecipientEmailAddress parameter is empty or number of valid email addresses are zero, then return BadRequest

Create wishlist copy using wishlist copy service with removeListSpecificData set to true (this will remove Notes, Description and other "personal" information) and send to each address from the list.

HTTP Verb – PATCH

URL – /api/v1/wishlists/{wishListId}

Description – Updates the wishlists.

Base – HandlerBase<UpdateWishListSendACopyParameter, UpdateWishListSendACopyResult>

Handlers

OrderHandlerDescription
500GetWishListCalls GetWishList wishlist service with WishListId parameter
600UpdateWishListChecks UserProfileDto or RememberedUserProfileDto is owner from site context, otherwise return Forbidden

If Name is blank return BadRequest

Checks if non ShareOptionType.Static wishlist with same name already exists for current user and return BadRequest with MessageProvider.Current.Lists_Name_AlreadyExists message

If ShareOption parameter is equal WishList.ShareOptionType.AllCustomerUsers, then update wishlist CustomerId from BillTo site context

If ShareOption parameter is not equals to WishList.ShareOptionType.IndividualUsers, then remove all WishListShare records for that wishlist

Update AllowEdit, ShareOption parameters

Call CreateGetWishListResult wishlist pipeline and set GetWishListResult property.
700SendAllCustomerUsersEmailIf SendEmail parameter is false or ShareOption parameter is not equals to WishList.ShareOptionType.AllCustomerUsers, then execute next handler.

Set email object values and send emails for all activated customer users.
800SendIndividualUsersEmailIf SendEmail parameter is false or ShareOption parameter is not equals to WishList.ShareOptionType.IndividualUsers, then execute next handler.

If SenderName parameter is blank, then return BadRequest

If number of valid emails in RecipientEmailAddress parameter is zero, then return BadRequest

Set email object values, create WishListShare record for each address and send email with unique invite link.
900UpdateWishListLinesIf WishListLineCollection parameter is empty execute next handler, otherwise call UpdateWishListLine wishlist service and update all records.