Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

The Optimizely <<product-name>> REST API is made up of RESTful-based services that interact with <<product-name>> data within the context of user interaction using JSON objects. These API objects and their respective methods are based on common HTTP verbs.

The following were considerations when the Commerce API was built:

  • Open up the platform so other platforms can connect to <<product-name>> (connected commerce)

  • Move customizations to outside the platform

  • Allow developers to build services around the API so the platform offers a developer friendly, flexibility and modern experience

  • Integration and extension point to <<product-name>>

  • Allow for seamless upgrades

  • Facade in front of the application so improvements can be made with little interruption

  • Scalability

### What is the difference between Commerce API vs Administrative API?

The Commerce API delivers digital commerce functionality such as viewing products related to a website, adding products to a user's cart and working with user account information. Whereas the Administrative API provides data level access to all objects. The Administrative API can be used when integrating other platforms where there is a need to work with all objects in the <<product-name>> platform, not just those under user or website context.

## Build a digital commerce workflow using jQuery and the Commerce API

The following code demonstrates basic commerce work flow usage of the Commerce API.

  1. Sign In and Create Session

  2. Retrieve Product Catalog

  3. Retrieve All Categories

  4. Search for Product Using a Query

  5. Retrieve Product Details

  6. Create Wishlist and Add Product to Wish List

  7. Add Product to Shopping Cart

  8. Change Quantity of Product in Shopping Cart

  9. Submit Order

### Sign in and create session

Signing into Optimizely involves two requests: one to authenticate with Identity Server and a second to create a session.

The first request authenticates you with Identity Server. If you haven't before authenticated with Identity Server in <<product-name>>, you can follow the steps in the Using Fiddler to interact with the <<product-name>> API article to find out how.

The second request creates a session within the <<product-name>> application, allowing the current user to manage his or her account, create wish lists, submit orders, and so on.

### Retrieve product catalog

This request retrieves the product catalog available within the current context (such as user, customer, website). Notice that this request does not include the bearer token because authentication may not be required based on the related settings.

### Retrieve all categories

### Search for product using a query

This request allows the product catalog to be searched given a query.

### Retrieve product details

Once a product has been found using search, you can go to it. This request returns the details of a specific product. The "productId" value may need to change based on the data available in your ISC application.

### Create wishlist and add product to wish list

If you want to remember a product for later, you can create a wish list and add the product to it.

The first request creates a new wish list for the current user given a name.

The second request adds a product to the wish list that was just created.

### Add Product to Shopping Cart

When you've decided upon a product, this request will add it to the cart with a specific quantity.

### Change Quantity of Product in Shopping Cart

If you've changed your mind about a product, you can update it in the cart using the request below. This specific request will increase the quantity ordered.

### Submit Order

Finally, you can complete your order using the request below. The data in the request will need to include the current cart updated with shipping information, payment method, and so on.

### Working with APIs

You can continue to explore and learn about the RESTful APIs here: [](🔗)