Loading...
Area: Episerver B2B Commerce

Websites API handler

Recommended reading 

HTTP Verb: GET

URL: /api/v1/websites/current/countries

Description: Returns country collection

Base: HandlerBase<GetCountryCollectionParameter, GetCountryCollectionResult>

Handlers:

Order Handler

Description

500 GetCountryCollectionHandler

Gets all the active countries for the current website. If the "GetStates" parameter is "true" then also grabs all states for each country.

Order Handler Description
500 GetCountryQuery Creates the initial country query that returns all countries. The query is stored in the CountryQuery property on the result object.
600 ApplyFiltering Applies 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.
700 ApplySort Applies 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.
800 ExecuteQuery Executes theCountryQuery after the query has been filtered and sorted. The result is stored in theCountryCollection property on the result object.
900 CreateGetCountryResults TheCountryCollection property on the result object is transformed into a collection ofGetCountryResult objects. The result is stored in theGetCountryResults property on the result object.
1000 GetStates If 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:

Order Handler

Description

500 GetCountryHandler

Gets the active country that matches the passed in countryid parameter for the current website. If no country is found, then Not Found error result is returned. If the "GetStates" parameter is set to "true" then also gets all the states for that country.

Order Handler Description
500 GetCountry Retrieves 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:

Order Handler

Description

500 GetCurrencyCollectionHandler

Gets all the active currencies for the current website.

Order Handler Description
500 GetCurrencyCollection

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:

Order Handler

Description

500 GetCurrencyHandler

Gets the active currecy that matches the passed in currencyid parameter for the current website. If no currency is found, then Not Found error result is returned.

Order Handler Description
500 GetCurrency Retrieves 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:

Order Handler

Description

500 GetLanguageCollectionHandler

Gets all the active languages for the current website.

Order Handler Description
500 GetLanguageCollection

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:

Order Handler

Description

500 GetLanguageHandler

Gets the active language that matches the passed in languageid parameter for the current website. If no language is found, then Not Found error result is returned.

Order Handler Description
500 GetLanguage Retrieves 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:

Order Handler

Description

500 GetStateCollectionHandler

Gets all the active states for the current website. If the countryId parameter has as value, then gets only the states for that country.

Order Handler Description
900 CreateGetStateResults TheStateCollection property on the result object is transformed into a collection ofGetStateResult objects. The result is stored in theGetStateResults property on the result object.
800 ExecuteQuery Executes theStateQuery after the query has been filtered and sorted. The result is stored in theStateCollection property on the result object.
700 ApplySort Applies 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.
600 ApplyFiltering Applies 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.
500 GetStateQuery Creates 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:

Order Handler

Description

500 GetStateHandler

Gets the active state that matches the passed in stateid parameter for the current website. If no state is found, then Not Found error result is returned.

Order Handler Description
500 GetState Retrieves 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:

Order Handler

Description

500 GetWebsiteHandler

Gets the current website. If "GetCountries" is "true", then calls the GetCountryCollectionHandler, if error occurs then that error result is returned. If "GetStates" is "true", then calls the GetStateCollectionHandler, if error is occurs then that error result is returned. If "GetLanguages" is "true", then GetLanguageCollectionHandler is called, if error occurs then that error result is returned. If "GetCurrencies" is "true", then calls the GetCurrencyCollection handler is called, if an error occurs, then that error result is returned.

Order Handler Description
500 GetWebsite Retrieves the current website and stores the result to theWebsite property on the result object.
600 GetCountries If 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.
700 GetStates

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

800 GetLanguages If 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.
900 GetCurrencies If 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.
1000 CopyCustomPropertiesToResult Copies custom properties configured for the website entity to the website object stored in the Website property on the result object.

 

HTTP Verb: GET

URL: /api/v1/websites/current/states

Description: Gets the States for the specified Website identifier.

Base: HandlerBase<GetStatesParameter, GetStatesResult>

Handlers:

Order Handler Description
500 GetStateQuery Creates the initial state query that returns all states. The query is stored in theStateQuery property on the result object.
600 ApplyFiltering Applies 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.
700 ApplySort Applies 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.
800 ExecuteQuery Executes theStateQuery after the query has been filtered and sorted. The result is stored in theStateCollection property on the result object.
900 CreateGetStateResults TheStateCollection property on the result object is transformed into a collection ofGetStateResult objects. The result is stored in theGetStateResults property on the result object.

 

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>

Order Handler Description
500

GetBillToAddressFields

Retrieves the bill-to address fields for the current website. The values are stored in the BillToAddressField property on the result object.
600

GetShipToAddressFields

Retrieves 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:

Order Handler Description
500 GetCrossSellCollectionHandler Gets a collection of active cross sell products for the current website.
Order Handler Description
500 ValidateContext Uses 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).
600 GetWebsiteCrossSellQuery Creates 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.
700 GetProductCrossSellQuery Creates 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.
800 CreateCrossSellProductDtos Executes 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.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading