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 –
Order | Handler | Description |
---|---|---|
500 | ValidateContext | 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 |
600 | AddWishList | 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. |
700 | CreateGetWishListResult | Get 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishList | Call GetWishList with WishListId parameter |
600 | GetProducts | Call GetProductCollection with IgnoreIsConfigured set to false and ProductIds from AddWishListLineParameterCollection parameter |
700 | AddOrUpdateWishListLineCollection | 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishList | Call GetWishList with WishListId parameter |
600 | GetProduct | Call GetProduct with ProductId parameter |
700 | AddWishListLine | 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. |
800 | CreateGetWishListLineResult | Call 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishList | 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. |
600 | GetSharedUsers | If 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishList | Calls GetWishList with WishListId parameter and setting GetHiddenProducts to true. |
600 | CreateGetWishListLineResult | 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 –
Order | Handler | Description |
---|---|---|
500 | ValidateContext | Check GetStaticList parameter is false and UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden |
600 | GetWishListQuery | Create WishListQuery query, if IncludeWishListLines parameter is true, then expand Product, ModifiedByUserProfile and WishListShares |
700 | ApplyFiltering | If 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. |
730 | ApplySort | Sort WishListQuery. See additional information below. |
770 | ApplyPaging | Applies 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). |
800 | ExecuteQuery | Sorts WishListQuery and executes query. See additional information below. |
900 | SelectDefaultWishList | If allow multiple wishlists setting is false and number of wishlists in result is more then 1 - get last modified wishlist. |
1000 | AddWishlist | Creates new wishlist with default name, if allow multiple wishlists is false and there is no wishlists in results and WishListId parameter was empty. |
1100 | CreateGetWishListResults | Iterates 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 –
Order | Handler | Description |
---|---|---|
500 | ValidateContext | Check that UserProfileDto or RememberedUserProfileDto is not null in site context, otherwise return Forbidden. |
600 | GetWishListLinesQuery | Create WishListLineQuery query. |
700 | ApplyFiltering | 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. |
730 | ApplySort | Sorts WishListLineQuery based on the Sort parameter. Available sorts: CreatedOn CreatedOn DESC SortOrder default SortOrder DESC Product.ShortDescription Product.ShortDescription DESC. |
770 | ApplyPaging | Applies 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). |
800 | CreateGetWishListLineCollectionResults | Executes the WishListLineQuery and uses the CreateWishListLineResults pipeline on WishListPipeline to create WishListLineResults. |
900 | SelectDefaultWishList | If 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 Value | Sort 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 value | WishListLinesSort Description |
---|---|
"mostRecent" | Sorts by CreatedOn property descending |
any other value | Sorts by SortOrder property |
HTTP Verb – DELETE
URL – /api/v1/wishlists/{wishlistid:guid}
Description – Remove a single wish list.
Base – HandlerBase<RemoveWishListParameter, RemoveWishListResult>
Handlers –
Order | Handler | Description |
---|---|---|
500 | GetWishList | Calls GetWishList with WishListId parameter |
600 | RemoveWishList | Check 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>
Order | Handler | Description |
---|---|---|
500 | GetWishList | Calls GetWishList with WishListId parameter and GetHiddenProducts with true value. Then filters GetWishListLineResults with WishListLineIds parameter. |
600 | RemoveWishListLineCollection | Checks 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishListLine | Calls GetWishListLine wishlist service with WishListId and WishListLineId parameters |
600 | RemoveWishListLine | Checks 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>
Order | Handler | Description |
---|---|---|
500 | GetWishList | Calls GetWishList wishlist service with WishListId parameter |
600 | RemoveWishListShare | Checks 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 –
Order | Handler | Description |
---|---|---|
500 | ValidateQty | If Qty parameter is less or equals to zero, then return WishListServiceQtyTooSmall with MessageProvider.Current.Quantity_Too_Small message |
600 | GetWishListLine | Call GetWishListLine wishlist service with WishListId, WishListLineId parameters |
700 | UpdateWishListLine | 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. |
800 | CreateGetWishListLineResult | Call 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 –
Order | Handler | Description |
---|---|---|
500 | ActivateWishListShare | 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 |
600 | GetWishList | Call 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 –
Order | Handler | Description |
---|---|---|
500 | GetWishList | Call GetWishList wishlist service with WishListId parameter |
600 | SendACopy | 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>
Order | Handler | Description |
---|---|---|
500 | GetWishList | Calls GetWishList wishlist service with WishListId parameter |
600 | UpdateWishList | 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. |
700 | SendAllCustomerUsersEmail | 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. |
800 | SendIndividualUsersEmail | 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. |
900 | UpdateWishListLines | If WishListLineCollection parameter is empty execute next handler, otherwise call UpdateWishListLine wishlist service and update all records. |
Updated over 1 year ago