Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Wishlist

Describes the Wishlist API handler in Optimizely Configured Commerce.

HTTP Verb – POST

URL – /api/v1/wishlists

Description – Adds a single wish list

Base – HandlerBase<AddWishListParameter, WishListResult>

Handlers –

OrderHandlerDescription
500ValidateContext

Check 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

600AddWishList

If 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
500GetWishListCall GetWishList with WishListId parameter
600GetProductsCall GetProductCollection with IgnoreIsConfigured set to false and ProductIds from AddWishListLineParameterCollection parameter
700AddOrUpdateWishListLineCollection

If 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
500GetWishListCall GetWishList with WishListId parameter
600GetProductCall GetProduct with ProductId parameter
700AddWishListLine

If 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
500GetWishList

Call 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
500GetWishListCalls GetWishList with WishListId parameter and setting GetHiddenProducts to true.
600CreateGetWishListLineResult

Tries 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
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
500ValidateContextCheck that UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden.
600GetWishListLinesQueryCreate WishListLineQuery query.
700ApplyFiltering

Filter 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
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
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
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
700UpdateWishListLine

Checks 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
500ActivateWishListShare

If 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
600SendACopy

If 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.

Handlers –

Base – HandlerBase<UpdateWishListSendACopyParameter, UpdateWishListSendACopyResult>

OrderHandlerDescription
500GetWishListCalls GetWishList wishlist service with WishListId parameter
600UpdateWishList

Checks 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.

700SendAllCustomerUsersEmail

If 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.

800SendIndividualUsersEmail

If 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.