HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Once you have configured the API SDK, you can make calls to the B2B 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);

Did this page help you?