Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Zoom

Zoom

Zoom allows you to batch multiple GET requests into a single HTTP request, which can greatly reduce the number of calls required to perform API operations. For example, in order to render a check out page showing a customer's cart, billing address, shipping address, total costs, and taxes owing, you would need to make quite a few calls to the API to retrieve this data. But by using Zoom, you can retrieve all the data with a single Zoom call. Zoom also improves performance by returning only the relevant data you are requesting. For example, the Zoom request www.onlinestore.com/slots/<scope> ?zoom=element:oneevent, returns only the slots with an oneevent, slots without an oneevent are not returned (see below for example).

Zoom tunnels down to the request's grandchild and returns those results without returning any of the grandchild's parents. What that means is a Zoom like this, www.onlinestore.com/carts/<scope>/default ?zoom=lineitems:element:price, where price is the grandchild, returns a JSON object containing arrays of the prices. It does not return the results from the grandchild's parents, which in this case are carts,lineitems, and element. If you want to retrieve results from the grandchild's parent , you will have to create other Zooms to do so. See the examples below for how to do this.

Zoom is specified in a query string at the end of a GET request: ?zoom= Zoom retrieves the objects specified in the query, packages the objects into Zoom arrays, appends the arrays to a JSON object, and returns that object to the client application (see below for examples). Zoom query parameters follow a specific structure, which are described in the Zoom Formatting section below.

The examples below are by no means the definitive set of Zoom requests. You will need to experiment with Zoom to discover the queries that suit your purposes.

Tip: Zoom and FollowLocation

Zoom and?followLocationcan be used together. For more information, see Using ?followLocation with ?zoom.

Zoom Basics

Zoom is specified in a query string at the end of the GET request with commas and colons separating the Zoom parameters. For example,
http://www.onlinestore.com/carts/<scope>/default?zoom=total,lineitems:element:item:price 

In this example, we are Zooming on the cart's resource and retrieving the cart's total, ?zoom=total, and the prices for each item in the cart, lineitems:element:item:price. An important distinction to make here is that Zoom, zooms into the resource you are calling the GET on. In the example above we are Zooming on the cart's resource, so all the Zoom parameters apply to the cart. Zoom allows you to make multiple resource requests, like in our example we are GETing the cart's resource and GETing the cart's item prices, but you can't Zoom through some another unrelated resource at the same time. For example, you couldn't run a Zoom on cart and profiles at the same time, you have to Zoom these separately.

Zoom Results

Results are appended as Zoom arrays to a JSON object, which is then returned to the client app through the HTTP request. Zoom results have the following characteristics:

  • Zoom arrays are prefixed with an underscore _
  • The Zoom arrays are nested according to the Zoom parameter order. For example, our Zoom shown above, ?zoom= lineitems:element:item:price returns nested like this:
    
       + cart
          + Self
          + Links
             - _lineitems 
             - _element 
             - _item 
             - _price    
                   
  • The Zoom query is included in the JSON object's self URI field
  • Zoom arrays are ordered according to the resource's links order, not the order of the zoom parameters. Our example above, ?zoom=total, lineitems:element:item:price, returns a JSON object with the :lineitems array before the:totals array because lineitems come before totals in a cart.

Malformed Zoom Requests

Different results returned depending on what is malformed:

  • Misspelled resources (profiles/<scope>/default?zoom=addresses:elemenewsttest) or Zooming into an unrelated resource (profiles/<scope>/default?zoom=addresses:elements:assets) returns status 200 and the request's base object, which in this case is the profiles JSON. Zoom does not return an error message in this situation.
  • Invalid characters return status 400 and a message "Zoom query is invalid."
  • Partially valid requests (profiles/<scope>/default?zoom=addresses:elements,paymentmethods:elemetnse) only return the valid part of the request. In this case, the address elements are returned, but the paymentmethod elements, as elements is spelled wrong in the request, are not.

Zoom Formatting

Table 1.
Character Description
, Separates additional resource requests
: Identifies the rel paths to drill down into

Zoom Restrictions

Zoom has the following restrictions:

  • Zoom lengths are restricted to 2048 characters (Internet's URL length restriction).
  • Zoom rel paths are restricted to a depth of 10. For example, ?zoom=rel1:rel2:rel3:rel4:rel5:rel6:rel7:rel8:rel9:rel10:rel11, is not allowed
  • Additional resource requests do not have restrictions. For example, ?zoom=rel1,rel2,rel3,rel4,rel5,rel6,rel7,rel8,rel9,rel10,rel11,rel12, is allowed
  • These characters are not supported in zoom: spaces, control characters, and URI unsafe characters $ & + , / : ; = ? @ < > # % { } | \ ^~ [ ] ` ' "

Zoom Max-Age

A Zoom array's max-age is defined by the lowest max-age value in the objects returned in the request.

Zoom Examples

The examples below are by no means an exhaustive set of all the possible zoom calls. The examples are just to get you started thinking about the capabilities of zoom and how they can help you speed up your Cortex API client's performance.

GET a cart's item definitions

This Zoom retrieves a cart's item definitions.

http://www.onlinestore/carts/<scope>/default?zoom=lineitems:element:item:definition

{
  "self": {
        "type": "application/vnd.elasticpath.cart",
        "uri": "/commerce-legacy/carts/<scope>/<itemid>?zoom=lineitems:element:item:definition",
        "href": "http://www.onlinestore.com/carts/<scope>/<profileid>?zoom=lineitems:element:item:definition",
        "max-age": 0
  },
    "links": [
    {
        "type": "application/vnd.elasticpath.links",
        "rel": "lineitems",
        "rev": "cart",
        "href": "http://www.onlinestore.com/carts/<scope>/<profileid>/lineitems",
        "uri": "/commerce-legacy/carts/<scope>/<profileid>/lineitems"
    },
    {
        "type": "application/vnd.elasticpath.total",
        "rel": "total",
        "rev": "cart",
        "href": "http://www.onlinestore.com/totals/carts/<scope>/<profileid>",
        "uri": "/commerce-legacy/totals/carts/<scope>/<profileid>"
    },
    {
        "type": "application/vnd.elasticpath.order",
        "rel": "order",
        "rev": "cart",
        "href": "http://www.onlinestore.com/orders/<scope>/<orderid>",
        "uri": "/commerce-legacy/orders/<scope>/<orderid>"
    }
  ],
    "_lineitems": [
    {
        "_element": [
        {
            "_item": [
            {
                "_definition": [
                {
                    "self": {
                        "type": "application/vnd.elasticpath.itemdefinition",
                        "uri": "/commerce-legacy/itemdefinitions/<scope>/<itemid>",
                        "href": "http://www.onlinestore.com/itemdefinitions/<scope>/<itemid>",
                        "max-age": 600
                  	},
                    "links": [
                    {
                        "type": "application/vnd.elasticpath.item",
                        "rel": "item",
                        "rev": "definition",
                        "href": "http://www.onlinestore.com/items/<scope>/<itemid>",
                        "uri": "/commerce-legacy/items/<scope>/<itemid>"
                    },
                    {
                        "type": "application/vnd.elasticpath.links",
                        "rel": "assets",
                        "rev": "definition",
                        "href": "http://www.onlinestore.com/assets/itemdefinitions/<scope>/<itemid>",
                        "uri": "/commerce-legacy/assets/itemdefinitions/<scope>/<itemid>"
                    }
                ],
                    "display-name": "Samsung Headset"
                }
              ]
            }
          ]
        },
        {
            "_item": [
            {
                "_definition": [
                {
                    "self": {
                        "type": "application/vnd.elasticpath.itemdefinition",
                        "uri": "/commerce-legacy/itemdefinitions/<scope>/<itemid>",
                        "href": "http://www.onlinestore.com/itemdefinitions/<scope>/<itemid>",
                        "max-age": 600
                   },
                   "links": [
                   {
                        "type": "application/vnd.elasticpath.item",
                        "rel": "item",
                        "rev": "definition",
                        "href": "http://www.onlinestore.com/items/<scope>/<itemid>",
                        "uri": "/commerce-legacy/items/<scope>/<itemid>"
                   },
                   {
                        "type": "application/vnd.elasticpath.links",
                        "rel": "assets",
                        "rev": "definition",
                        "href": "http://www.onlinestore.com/assets/itemdefinitions/<scope>/<itemid>",
                        "uri": "/commerce-legacy/assets/itemdefinitions/<scope>/<itemid>"
                   }
                   ],
                    "display-name": "T3 Bluetooth Headset"
                }
              ]
            }
          ]
        }
      ]
    }
  ],
        "total-quantity": 2
}

GET slots with an oneevent

Return the storefront's slots with onevents. Slots without oneevents are not returned.

http://www.onlinestore.com/slots/<scope>?zoom=element:onevent

{
    "self": {
        "type": "application/vnd.elasticpath.links",
        "uri": "/commerce-legacy/slots/<scope>?zoom=element",
        "href": "http://www.onlinestore.com/slots/<scope>?zoom=element",
        "max-age": 600
  },
    "links": [
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    },
    {
        "type": "application/vnd.elasticpath.slot",
        "rel": "element",
        "rev": "list",
        "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
        "uri": "/commerce-legacy/slots/<scope>/<slotid>"
    }
  ],
    "_element": [
    {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "End Of Year Sales Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "Bottom Page Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageOfferBottomRight"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/color-banner-uk.jpg",
            "name": "Homepage Left Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageOfferTopMiddle"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageOfferTopRight"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageOfferTopLeft"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/color-banner-uk.jpg",
            "name": "Homepage Top Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageOfferBottomLeft"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "HomepageHero"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/color-banner-uk.jpg",
            "name": "IOS Device Product Page Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "top_banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/gift_bag.gif",
            "name": "Super Awesome DCAPI Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.node",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/navigations/<scope>/<slotid>",
            "uri": "/commerce-legacy/navigations/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/color-banner-en.png",
            "name": "Video Games Category Page Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/flash/banner-us.swf",
            "name": "Games Product Page Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/color-banner-uk.jpg",
            "name": "Big Sales Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.node",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/navigations/<scope>/<slotid>",
            "uri": "/commerce-legacy/navigations/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/gift_bag.gif",
            "name": "Movies Category Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            },
            {
            "type": "application/vnd.elasticpath.item",
            "rel": "onevent",
            "href": "http://www.onlinestore.com/items/<scope>/<slotid>",
            "uri": "/commerce-legacy/items/<scope>/<slotid>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/bg_see_details.gif",
            "name": "Weekly Movie Promo Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "content-location": "http://<scope>.elasticpath.com:8080/images/bg_offer_a.gif",
            "name": "Promo Banner"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.slot",
            "uri": "/commerce-legacy/slots/<scope>/<slotid>",
            "href": "http://www.onlinestore.com/slots/<scope>/<slotid>",
            "max-age": 600
          },
        "links": [
            {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/slots/<scope>",
            "uri": "/commerce-legacy/slots/<scope>"
            }
          ],
            "name": "PromoBanner"
        }
    ]
}

GET a profile's addresses and payment methods

Returns the logged in customer addresses and payment methods.

http://www.onlinestore.com/profiles/<scope>?zoom=addresses:element,paymentmethods:element

{
    "self": {
        "type": "application/vnd.elasticpath.profile",
        "uri": "/commerce-legacy/profiles/<scope>/<profileid>?zoom=addresses:element,
        "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>?zoom=addresses:element,
        "max-age": 0
  },
    "links": [
    {
        "type": "application/vnd.elasticpath.links",
        "rel": "addresses",
        "rev": "profile",
        "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>/addresses",
        "uri": "/commerce-legacy/profiles/<scope>/<profileid>/addresses"
    },
    {
        "type": "application/vnd.elasticpath.links",
        "rel": "purchases",
        "href": "http://www.onlinestore.com/purchases/<scope>",
        "uri": "/commerce-legacy/purchases/<scope>"
    },
    {
        "type": "application/vnd.elasticpath.links",
        "rel": "paymentmethods",
        "rev": "profile",
        "href": "http://www.onlinestore.com/paymentmethods/<scope>",
        "uri": "/commerce-legacy/paymentmethods/<scope>"
    }
  ],
    "_addresses": [
    {
        "_element": [
            {
            "self": {
                "type": "application/vnd.elasticpath.address",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>/addresses/<addressid>",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>/addresses/<addressid>",
                "max-age": 0
                  },
            "links": [
                    {
                "type": "application/vnd.elasticpath.profile",
                "rel": "profile",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>"
                    },
                    {
                "type": "application/vnd.elasticpath.links",
                "rel": "list",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>/addresses",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>/addresses"
                    }
                  ],
            "address": {
                "country-name": "CA",
                "extended-address": "Siffon Ville",
                "locality": "St. Helens",
                "postal-code": "v8v8v8",
                "region": "MB",
                "street-address": "1234 HappyVille Road"
                  },
            "name": {
                "family-name": "boxer",
                "given-name": "ben"
                  },
            "telephone": [
                    {
                "type": "voice",
                "value": "1-342-323-5435"
                    }
                  ]
            },
            {
            "self": {
                "type": "application/vnd.elasticpath.address",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>/addresses/<addressid>",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>/addresses/<addressid>",
                "max-age": 0
                  },
            "links": [
                    {
                "type": "application/vnd.elasticpath.profile",
                "rel": "profile",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>"
                    },
                    {
                "type": "application/vnd.elasticpath.links",
                "rel": "list",
                "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>/addresses",
                "uri": "/commerce-legacy/profiles/<scope>/<profileid>/addresses"
                    }
                  ],
            "address": {
                "country-name": "US",
                "extended-address": "110 Liberty Street",
                "locality": "New York",
                "postal-code": "NY 10006",
                "region": "NY",
                "street-address": "Hoyip Chinese Restaurant"
                  },
            "name": {
                "family-name": "boxer",
                "given-name": "ben"
                  },
            "telephone": [
                    {
                "type": "voice",
                "value": "+1 212-349-8286"
                    }
                  ]
                }
              ]
        }
      ],
    "_paymentmethods": [
    {
        "_element": [
        {
        "self": {
            "type": "application/vnd.elasticpath.paymentmethod.creditcard",
            "uri": "/commerce-legacy/paymentmethods/<scope>/<paymentmethodid>",
            "href": "http://www.onlinestore.com/paymentmethods/<scope>/<paymentmethodid>",
            "max-age": 0
              },
        "links": [
                {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/paymentmethods/<scope>",
            "uri": "/commerce-legacy/paymentmethods/<scope>"
                },
                {
            "type": "application/vnd.elasticpath.profile",
            "rel": "profile",
            "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>",
            "uri": "/commerce-legacy/profiles/<scope>/<profileid>"
                }
              ],
            "card-number": "************0004",
            "card-type": "MasterCard",
            "cardholder-name": "Ben Boxer",
            "expiry-month": "3",
            "expiry-year": "2013"
        },
        {
        "self": {
            "type": "application/vnd.elasticpath.paymentmethod.creditcard",
            "uri": "/commerce-legacy/paymentmethods/<scope>/<paymentmethodid>",
            "href": "http://www.onlinestore.com/paymentmethods/<scope>/<paymentmethodid>",
            "max-age": 0
              },
        "links": [
                {
            "type": "application/vnd.elasticpath.links",
            "rel": "list",
            "href": "http://www.onlinestore.com/paymentmethods/<scope>",
            "uri": "/commerce-legacy/paymentmethods/<scope>"
                },
                {
            "type": "application/vnd.elasticpath.profile",
            "rel": "profile",
            "href": "http://www.onlinestore.com/profiles/<scope>/<profileid>",
            "uri": "/commerce-legacy/profiles/<scope>/<profileid>"
                }
              ],
            "card-number": "************0004",
            "card-type": "MasterCard",
            "cardholder-name": "Ben G Boxer",
            "expiry-month": "5",
            "expiry-year": "2014"
            }
          ]
        }
    ],
        "family-name": "boxer",
        "given-name": "ben",
        "username": "ben.boxer@elasticpath.com"
}

Using ?followLocation with ?zoom

Use ?followLocation and ?zoom together to reduce the number of HTTP calls required for POST operations. ?followLocation automatically returns the result of the POST operation. Without ?followLocation, Cortex API returns a response with a location header that links to the result of the POST operation, which the client must then GET. By using ?followLocation and ?zoom together, you can POST an operation, GET its results, and zoom through the results with a single call.

How do I connect ?followLocation and ?zoom ?

Use ampersand & to connect ?followLocation and ?zoom together: http://www.onlinestore.com/searches/<scope>/keywords/items ?followLocation&zoom=element

?zoom and ?followLocation Examples

The examples below are by no means an exhaustive set of all the possible uses for ?followLocation and ?zoom. The examples are just to get you started thinking about ways you can speed up your client app's performance by using these technologies. Test different combinations of ?followLocation and ?zoom to discover the best calls that work for you.

Searching with ?zoom and ?followLocation

Searching with ?followLocation and ?zoom reduces the searches to two calls:

  1. GET the search form
  2. POST the form using ?followLocation and ?zoom: http://www.onlinestore.com/searches/<scope>/keywords/items?followLocation&zoom=element:definition

Result:

After the POST, search results are bundled into a zoom array and returned to the client. The zoom array's size is based on the search's page-size setting, so, if the page-setting is set to ten, the zoom array could have ten search results, depending if ten or more search results were returned. For more information on page-size setting, see POST- create a search.