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

Websites

Describes the Websites API handler in Optimizely Configured Commerce.

HTTP Verb – GET

URL – /api/v1/websites/current/countries

Description – Returns country collection

Base – HandlerBase<GetCountryCollectionParameter, GetCountryCollectionResult>

Handlers

OrderHandlerDescription
500GetCountryQueryCreates the initial country query that returns all countries. The query is stored in the CountryQuery property on the result object.
600ApplyFilteringApplies filtering to theCountryQuery property on the result object. The query will be filtered to return active countries assigned to the current website. If theCountryId property on the parameter object has a value, the query will be filtered to return only countries with that id.
700ApplySortApplies sorting to theCountryQuery property on the result object. If theSort property on the parameter object has a value, the query will be sorted with that value. If theSort property on the parameter object DOES NOT have a value, the query will be sorted by theCountry.Name property.
800ExecuteQueryExecutes theCountryQuery after the query has been filtered and sorted. The result is stored in theCountryCollection property on the result object.
900CreateGetCountryResultsTheCountryCollection property on the result object is transformed into a collection ofGetCountryResult objects. The result is stored in theGetCountryResults property on the result object.
1000GetStatesIf theGetStates property on the parameter object is true, the states will be retrieved for every country in theGetCountryResults property on the result object. The states are retrieved using theGetStateCollectionHandler handler chain. The results are stored in each of theGetCountryResults.GetStatesCollectionResult properties.

HTTP Verb – GET

URL – /api/v1/websites/current/countries/{countryid}

Description – Returns a single country

Base – HandlerBase<GetCountryParameter, GetCountryResult>

Handlers

OrderHandlerDescription
500GetCountryRetrieves a country using theGetCountryCollectionHandler handler chain. TheCountryId property on the parameter object is used to find the country. If a country is not found or more than one country is found, an error is returned.

HTTP Verb – GET

URL – /api/v1/websites/current/currencies

Description – Returns currency collection

Base – HandlerBase<GetCurrencyCollectionParameter, GetCurrencyCollectionResult>

Handlers

OrderHandlerDescription
500GetCurrencyCollection

Retrieves currencies for the current website using the currency repository.

If the current user is not a content reviewer, the query returns only currencies that are live.The query is filtered to return only currencies that have at least one currency rate with an effective date prior to the current date and time.If the CurrencyId property on the parameter object has a value, the query will be filtered to return only currencies with that id.The query is sorted by the WebsiteCurrency.IsDefault property then by the Currency.Description property.

HTTP Verb – GET

URL – /api/v1/websites/current/currencies/{currencyid}

Description – Returns a single currency

Base – HandlerBase<GetCurrencyParameter, GetCurrencyResult>

Handlers

OrderHandlerDescription
500GetCurrencyRetrieves a currency using theGetCurrencyCollectionHandler handler chain. TheCurrencyId property on the parameter object is used to find the currency. If a currency is not found or more than one currency is found, an error is returned.

HTTP Verb – GET

URL – /api/v1/websites/current/languages

Description – Returns language collection

Base – HandlerBase<GetLanguageCollectionParameter, GetLanguageCollectionResult>

Handlers

OrderHandlerDescription
500GetLanguageCollection

Retrieves languages for the current website using the language repository.

  • If the current user is not a content reviewer, the query returns only languages that are live.
  • If the LanguageId property on the parameter object has a value, the query will be filtered to return only languages with that id.
  • The query is sorted by the WebsiteLanguage.IsDefault property then by the Language.Description property.

HTTP Verb – GET

URL – /api/v1/websites/current/languages/{languageid}

Description – Returns a single language

Base – HandlerBase<GetLanguageParameter, GetLanguageResult>

Handlers

OrderHandlerDescription
500GetLanguageRetrieves a language using the GetLanguageCollectionHandler handler chain. The LanguageId property on the parameter object is used to find the language. If a language is not found or more than one language is found, an error is returned.

HTTP Verb – GET

URL – /api/v1/websites/current/states

Description – Returns state collection

Base – HandlerBase<GetStateCollectionParameter, GetStateCollectionResult>

Handlers

OrderHandlerDescription
900CreateGetStateResultsTheStateCollection property on the result object is transformed into a collection ofGetStateResult objects. The result is stored in theGetStateResults property on the result object.
800ExecuteQueryExecutes theStateQuery after the query has been filtered and sorted. The result is stored in theStateCollection property on the result object.
700ApplySortApplies sorting to theStateQuery property on the result object. If theSort property on the parameter object has a value, the query will be sorted with that value. If theSort property on the parameter object DOES NOT have a value, the query will be sorted by theState.Name property.
600ApplyFilteringApplies filtering to theStateQuery property on the result object. The query will be filtered to return only active states assigned to the current website. If theStateId property on the parameter object has a value, the query will be filtered to return only states with that id. If theCountryId property on the parameter object has a value, the query will be filtered to return only states that have a country with that id.
500GetStateQueryCreates the initial state query that returns all states. The query is stored in theStateQuery property on the result object.

HTTP Verb – GET

URL – /api/v1/websites/current/states/{stateid}

Description – Returns a single state

Base – HandlerBase<GetStateParameter, GetStateResult>

Handlers

OrderHandlerDescription
500GetStateRetrieves a state using the GetStateCollectionHandler handler chain. The StateId property on the parameter object is used to find the state. If a state is not found or more than one state is found, an error is returned.

HTTP Verb – GET

URL – /api/v1/websites

Description – Returns the current website

Base – HandlerBase<GetWebsiteParameter, GetWebsiteResult>

Handlers

OrderHandlerDescription
500GetWebsiteRetrieves the current website and stores the result to theWebsite property on the result object.
600GetCountriesIf theGetCountries property on the parameter object is true, the countries for the website will be retrieved. The countries are retrieved using theGetCountryCollectionHandler handler chain and the result is stored in theGetCountryCollectionResult property on the result object.
700GetStatesIf the GetStates property on the parameter object is true, the states for the website will be retrieved. The states are retrieved using the GetStateCollectionHandler handler chain and the result is stored in the GetStateCollectionResult property on the result object.
800GetLanguagesIf theGetLanguages property on the parameter object is true, the languages for the website will be retrieved. The languages are retrieved using theGetLanguageCollectionHandler handler chain and the result is stored in theGetLanguageCollectionResult property on the result object.
900GetCurrenciesIf theGetCurrencies property on the parameter object is true, the currencies for the website will be retrieved. The currencies are retrieved using theGetCurrencyCollectionHandler handler chain and the result is stored in theGetCurrencyCollectionResult property on the result object.
1000CopyCustomPropertiesToResultCopies custom properties configured for the website entity to the website object stored in the Website property on the result object.

[4.4][4.5]HTTP Verb – GET

URL – /api/v1/websites/current/states

Description – Gets the States for the specified Website identifier.

Base – HandlerBase<GetStatesParameter, GetStatesResult>

Handlers

OrderHandlerDescription
500GetStateQueryCreates the initial state query that returns all states. The query is stored in theStateQuery property on the result object.
600ApplyFilteringApplies filtering to theStateQuery property on the result object. The query will be filtered to return only active states assigned to the current website. If theStateId property on the parameter object has a value, the query will be filtered to return only states with that id. If theCountryId property on the parameter object has a value, the query will be filtered to return only states that have a country with that id.
700ApplySortApplies sorting to theStateQuery property on the result object. If theSort property on the parameter object has a value, the query will be sorted with that value. If theSort property on the parameter object DOES NOT have a value, the query will be sorted by theState.Name property.
800ExecuteQueryExecutes theStateQuery after the query has been filtered and sorted. The result is stored in theStateCollection property on the result object.
900CreateGetStateResultsTheStateCollection property on the result object is transformed into a collection ofGetStateResult objects. The result is stored in theGetStateResults property on the result object.

[4.4][4.5]HTTP Verb – GET

URL – /api/v1/websites/current/addressfields

Description – Returns the fields for the address page and whether they are visible.

Base – HandlerBase<GetAddressFieldsParameter, GetAddressFieldsResult>

OrderHandlerDescription
500GetBillToAddressFieldsRetrieves the bill-to address fields for the current website. The values are stored in the BillToAddressField property on the result object.
600GetShipToAddressFieldsRetrieves the ship-to address fields for the current website. The values are stored in the ShipToAddressFields property on the result object.

HTTP Verb – GET

URL – /api/v1/websites/current/crosssells

Description – Return a collection of global website cross sell products

Base – HandlerBase<GetCrossSellCollectionParameter, GetCrossSellCollectionResult>

Handlers

OrderHandlerDescription
500ValidateContextUses the GetProductSettingsHandler handler chain to retrieve product search settings and stores them in the GetProductSettingsResult property on the result object. If the CanSeeProducts property on the settings object equals "false", an error is returned (the current user cannot search for or see products).
600GetWebsiteCrossSellQueryCreates the initial cross sells query that returns active cross sells for the current website. If the WebCrossSell property on the parameter object equals "false", this handler is skipped. The cross sells query is stored in the CrossSellQuery property on the result object.
700GetProductCrossSellQueryCreates the initial cross sells query that returns active cross sells for a specific product. If the WebCrossSell property on the parameter object equals "true", this handler is skipped. If a product cannot be found using the ProductId property on the parameter object, an error is returned. The cross sells query is stored in the CrossSellQuery property on the result object.
800CreateCrossSellProductDtosExecutes the CrossSellQuery. The result is stored in the CrossSells property on the result object. Also, uses the CreateProductDtos catalog pipeline to transform the cross sells into a collection of ProductDtos. The transformed products are stored in the CrossSellProductDtos property on the result object.