Clover Platform Docs

Deprecation Notice - Some Expansions - Jan. 9, 2017

To optimize some of our services and their handling of expansions, we're going to deprecate a few expansions; these changes will impact REST services and the Android SDK. You'll want to review the deprecation list and determine if you need to adjust some of your queries and possibly submit an updated app.
These expansions will be deprecated on March 7th, 2017:

  • /v3/merchants/{mId}/orders?expand=customers
  • /v3/merchants/{mId}/customers?expand=orders
  • /v3/merchants/{mId}/employees?expand=orders
  • /v3/merchants/{mId}/employees?expand=payments
  • /v3/merchants/{mId}/employees/{empId}?expand=orders
  • /v3/merchants/{mId}/employees/{empId}?expand=payments
  • /v3/merchants/{mId}/orders?expand=employee
  • /v3/merchants/{mId}/payments?expand=employee
  • /v3/merchants/{mId}/paisnts?expand=order.employee

Here are an example adaptation for an app that seeks to associate customers to orders:

# This python sample code shows how to retrieve customer data associated with  
    # orders as an alternative to using the deprecated expansions.

    import json
    import time
    import urlfetch

    # Request to get order history from merchant
    orders_request_url = "https://apisandbox.dev.clover.com/v3/merchants/TB6EGCJW1K3EW/orders"
    headers = {"Authorization": "Bearer " + access_token, "Content-Type": "application/json"}
    orders_response = urlfetch.fetch(url = orders_request_url, headers = headers)

    # Checks to see if response is successful
    if orders_response.status_code >= 200 and orders_response.status_code < 300:
        orders_response = json.loads(orders_response.content)

        # Iterate through each order and prints out corresponding customer information
        for order in orders_response["elements"]:

            # Request to get individual order information with customer info expanded
            order_id = order['id']
            customers_request_url = "https://apisandbox.dev.clover.com/v3/merchants/TB6EGCJW1K3EW/orders/" + order_id + "?expand=customers"
            customers_response = urlfetch.fetch(url = customers_request_url, headers = headers)

            # Checks to see if reponse is successful
            if customers_response.status_code >= 200 and customers_response.status_code < 300:
                customers_response = json.loads(customers_response.content)

                # Checks to see if there's associated customer info
                if "customers" in customers_response:
                    customers_list = customers_response["customers"]

                    #Iterates through each customer and prints out order ID and customer ID
                    for customer in customers_list["elements"]:
                        print "Order " + order_id + " - Customer ID: " + customer["id"]
                else:
                     print "Order " + order_id + " - No customer data available"

                # Sleeps between requests to make sure it adheres to the API request limits
                # For more info: https://docs.clover.com/build/developer-guidelines/#rate-limiting
                time.sleep(.2)

            else:
                # Handle errors for unsuccessful response
                print "Error: Unsuccessful repsonse"
    else:
        # Handle errors for unsuccessful response
        print "Error: Unsuccessful response"

If your app is a large consumer of data, you should consider using our export API; more information can be found here. For technical questions please post to http://devask.clover.com. If you have any private questions or concerns you can contact us at [email protected]

Updated about a year ago


Deprecation Notice - Some Expansions - Jan. 9, 2017


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.