Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

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

Once you have configured the API SDK, you can make calls to the Configured Commerce API. To reduce the number of services you need to inject on your own, you should use the ICommerceAPIServiceProvider implementation you created in Step 2. Inject this into your class and call the appropriate getter method.

public YourClass(ICommerceAPIServiceProvider commerceAPIServiceProvider)
{
    public void DoSomething()
    {
        var result = await commerceAPIServiceProvider.GetAccountService().GetAccountsAsync();
        // Handle result
    }
}

Some service methods require you to provide values for the query parameters. QueryParameter objects can assist you in this area.

var parameters = new BillTosQueryParameters
    {
        Filter = this.CurrentSearchText,
        Page = this.currentPage,
        Exclude = new List<string> { "excludeshowall" },
    };

var billToResult = await commerceAPIServiceProvider.GetBillToService().GetBillTosAsync(parameters);