Customers

API change history

Provides methods for working with customer objects and data.

Get Customer Autoships

Retrieves an array of Autoships based on a valid Customer Id.

You can get the Request Parameter at these calls:

customerId

  • Get Customer IDs
  • Get Customer IDs by Filter

Try it

Request

Request URL

Request parameters

  • number

    The Id of the Customer for whom Autoships are to be retrieved.

  • (optional)
    bool

    Some autoships are related to services like website access. By default, these will be included. To only retrieve non-service autoships, pass "false".

Request headers

  • string
    Subscription key which provides access to this API. Found in your Profile.

Request body

Responses

200 OK

Returns an array of valid Autoship objects.

Representations

[
  {
    "AutoShipID": 1,
    "AssociateID": 12,
    "AssociateFirstName": "Sam",
    "AssociateLastName": "Space",
    "ShipAddress": {
      "Street1": "1234 Test Dr.",
      "Street2": "Ste. 360",
      "City": "Placerville",
      "PostalCode": "95667",
      "Region": "CA",
      "CountryCode": "US"
    },
    "StartDate": "2021-10-27T16:19:08Z",
    "Frequency": 0,
    "LastProcessDate": "2021-10-27T00:00:00Z",
    "NextProcessDate": "2021-11-27T00:00:00Z",
    "LastChargeAmount": 10,
    "Status": "Scheduled",
    "ShipMethodDescription": "UPS 3-Day Shipping",
    "ShipMethodID": 3,
    "PaymentMethodID": "_TESTCARD_E0BNK54A65",
    "PaymentDescription": "Visa ending in 4321",
    "PaymentExpirationMonth": "10",
    "PaymentExpirationYear": "2026",
    "PaymentMerchantID": 99,
    "AutoShipType": 0,
    "LineItems": [
      {
        "ItemID": 4,
        "Quantity": 2,
        "Cost": 0,
        "ExtendedPrice": 20,
        "ExtendedOriginalPrice": 20,
        "ExtendedBonus": 0,
        "ExtendedCV": 10,
        "ExtendedQV": 8,
        "ExtendedRewardPoints": 0,
        "ExtendedCost": 0,
        "ProductName": "SLJ84L",
        "Description": "Language description here",
        "Specifications": "Specifications here",
        "SEO": "",
        "LanguageCode": "en",
        "SKU": "SLJ84L",
        "SkuID": 4,
        "Category": {
          "ID": 1,
          "CategoryTranslations": [
            {
              "Id": 1,
              "CategoryId": 1,
              "Description": "Test Category",
              "Name": "Test Category",
              "LanguageCode": "en"
            }
          ],
          "Name": "Test Category",
          "Description": "Test Category",
          "DisplayIndex": 0,
          "ImageUrl": "",
          "ParentID": 0,
          "ProductLineID": 0,
          "ShortDescription": "Test Category",
          "StoreIDs": [],
          "HasChildren": false
        },
        "ChargeShipping": true,
        "Custom": {
          "ItemId": 0,
          "Field1": "asdf",
          "Field2": "1234",
          "Field3": "L|M",
          "Field4": "1,2,3,4,5",
          "Field5": ""
        },
        "Height": 12,
        "Image": "/no_image.jpg",
        "Length": 6,
        "LengthUOM": "in",
        "MPN": "11-22-gg",
        "OutOfStockStatus": 1,
        "PackCount": 0,
        "PackageGroupID": 1,
        "TaxClassID": 0,
        "UnitOfMeasure": "ea",
        "UPC": "Test UPC",
        "Weight": 0,
        "WeightUOM": "",
        "Width": 0,
        "FlagBirthDefects": false,
        "HasKitGroups": false,
        "FlagCancer": true,
        "PriceGroup": 1,
        "Images": [],
        "Prices": [
          {
            "GroupID": 1,
            "Price": 10,
            "PriceCurrency": "USD",
            "OriginalPrice": 10,
            "Bonus": 0,
            "CV": 5,
            "QV": 4,
            "RewardPoints": 0
          }
        ],
        "Options": [],
        "ItemOptions": [],
        "Languages": [
          {
            "Description": "Language description here",
            "LanguageCode": "en",
            "ProductName": "SLJ84L",
            "SEOKeywords": "",
            "Specifications": "Specifications here"
          }
        ],
        "OptionsMap": [],
        "HasOptions": false,
        "Price": 10,
        "PriceCurrency": "USD",
        "OriginalPrice": 10,
        "Bonus": 0,
        "CV": 5,
        "QV": 4,
        "RewardPoints": 0,
        "CouponsBeingUsed": 0,
        "StoreId": 5,
        "PriceGroups": [
          1
        ]
      }
    ],
    "Custom": {
      "Field1": "asdf",
      "Field2": "1234",
      "Field3": "a,b,c",
      "Field4": "122|344",
      "Field5": ""
    },
    "FrequencyString": "Every Week on Wednesday",
    "TotalCV": 10,
    "TotalQV": 8,
    "CurrencyCode": "USD",
    "SubTotal": 20
  }
]
{
  "type": "array",
  "items": {
    "required": [
      "AutoShipID",
      "AssociateID",
      "AssociateFirstName",
      "AssociateLastName",
      "ShipAddress",
      "StartDate",
      "Frequency",
      "LastProcessDate",
      "NextProcessDate",
      "LastChargeAmount",
      "Status",
      "ShipMethodID",
      "PaymentMethodID",
      "PaymentDescription",
      "PaymentExpirationMonth",
      "PaymentExpirationYear",
      "PaymentMerchantID",
      "AutoShipType",
      "LineItems",
      "Custom",
      "FrequencyString",
      "TotalCV",
      "TotalQV",
      "CurrencyCode",
      "SubTotal"
    ],
    "type": "object",
    "properties": {
      "AutoShipID": {
        "type": "integer"
      },
      "AssociateID": {
        "type": "integer"
      },
      "AssociateFirstName": {
        "type": "string"
      },
      "AssociateLastName": {
        "type": "string"
      },
      "ShipAddress": {
        "type": "object",
        "properties": {
          "Street1": {
            "type": "string"
          },
          "Street2": {
            "type": "string"
          },
          "City": {
            "type": "string"
          },
          "PostalCode": {
            "type": "string"
          },
          "Region": {
            "type": "string"
          },
          "CountryCode": {
            "type": "string"
          }
        }
      },
      "StartDate": {
        "type": "string"
      },
      "Frequency": {
        "type": "integer"
      },
      "LastProcessDate": {
        "type": "string"
      },
      "NextProcessDate": {
        "type": "string"
      },
      "LastChargeAmount": {
        "type": "integer"
      },
      "Status": {
        "type": "string"
      },
      "ShipMethodDescription": {
        "type": "string"
      },
      "ShipMethodID": {
        "type": "integer"
      },
      "PaymentMethodID": {
        "type": "string"
      },
      "PaymentDescription": {
        "type": "string"
      },
      "PaymentExpirationMonth": {
        "type": "string"
      },
      "PaymentExpirationYear": {
        "type": "string"
      },
      "PaymentMerchantID": {
        "type": "integer"
      },
      "AutoShipType": {
        "type": "integer"
      },
      "LineItems": {
        "type": "array",
        "items": {
          "required": [
            "ItemID",
            "Quantity",
            "Cost",
            "ExtendedPrice",
            "ExtendedOriginalPrice",
            "ExtendedBonus",
            "ExtendedCV",
            "ExtendedQV",
            "ExtendedRewardPoints",
            "ExtendedCost",
            "ProductName",
            "Description",
            "Specifications",
            "SEO",
            "LanguageCode",
            "SKU",
            "SkuID",
            "Category",
            "ChargeShipping",
            "Custom",
            "Height",
            "Image",
            "Length",
            "LengthUOM",
            "MPN",
            "OutOfStockStatus",
            "PackCount",
            "PackageGroupID",
            "TaxClassID",
            "UnitOfMeasure",
            "UPC",
            "Weight",
            "WeightUOM",
            "Width",
            "FlagBirthDefects",
            "HasKitGroups",
            "FlagCancer",
            "PriceGroup",
            "Images",
            "Prices",
            "Options",
            "ItemOptions",
            "Languages",
            "OptionsMap",
            "HasOptions",
            "Price",
            "PriceCurrency",
            "OriginalPrice",
            "Bonus",
            "CV",
            "QV",
            "RewardPoints",
            "CouponsBeingUsed",
            "StoreId",
            "PriceGroups"
          ],
          "type": "object",
          "properties": {
            "ItemID": {
              "type": "integer"
            },
            "Quantity": {
              "type": "integer"
            },
            "Cost": {
              "type": "integer"
            },
            "ExtendedPrice": {
              "type": "integer"
            },
            "ExtendedOriginalPrice": {
              "type": "integer"
            },
            "ExtendedBonus": {
              "type": "integer"
            },
            "ExtendedCV": {
              "type": "integer"
            },
            "ExtendedQV": {
              "type": "integer"
            },
            "ExtendedRewardPoints": {
              "type": "integer"
            },
            "ExtendedCost": {
              "type": "integer"
            },
            "ProductName": {
              "type": "string"
            },
            "Description": {
              "type": "string"
            },
            "Specifications": {
              "type": "string"
            },
            "SEO": {
              "type": "string"
            },
            "LanguageCode": {
              "type": "string"
            },
            "SKU": {
              "type": "string"
            },
            "SkuID": {
              "type": "integer"
            },
            "Category": {
              "type": "object",
              "properties": {
                "ID": {
                  "type": "integer"
                },
                "CategoryTranslations": {
                  "type": "array",
                  "items": {
                    "required": [
                      "Id",
                      "CategoryId",
                      "Description",
                      "Name",
                      "LanguageCode"
                    ],
                    "type": "object",
                    "properties": {
                      "Id": {
                        "type": "integer"
                      },
                      "CategoryId": {
                        "type": "integer"
                      },
                      "Description": {
                        "type": "string"
                      },
                      "Name": {
                        "type": "string"
                      },
                      "LanguageCode": {
                        "type": "string"
                      }
                    }
                  }
                },
                "Name": {
                  "type": "string"
                },
                "Description": {
                  "type": "string"
                },
                "DisplayIndex": {
                  "type": "integer"
                },
                "ImageUrl": {
                  "type": "string"
                },
                "ParentID": {
                  "type": "integer"
                },
                "ProductLineID": {
                  "type": "integer"
                },
                "ShortDescription": {
                  "type": "string"
                },
                "StoreIDs": {
                  "type": "array"
                },
                "HasChildren": {
                  "type": "boolean"
                }
              }
            },
            "ChargeShipping": {
              "type": "boolean"
            },
            "Custom": {
              "type": "object",
              "properties": {
                "ItemId": {
                  "type": "integer"
                },
                "Field1": {
                  "type": "string"
                },
                "Field2": {
                  "type": "string"
                },
                "Field3": {
                  "type": "string"
                },
                "Field4": {
                  "type": "string"
                },
                "Field5": {
                  "type": "string"
                }
              }
            },
            "Height": {
              "type": "integer"
            },
            "Image": {
              "type": "string"
            },
            "Length": {
              "type": "integer"
            },
            "LengthUOM": {
              "type": "string"
            },
            "MPN": {
              "type": "string"
            },
            "OutOfStockStatus": {
              "type": "integer"
            },
            "PackCount": {
              "type": "integer"
            },
            "PackageGroupID": {
              "type": "integer"
            },
            "TaxClassID": {
              "type": "integer"
            },
            "UnitOfMeasure": {
              "type": "string"
            },
            "UPC": {
              "type": "string"
            },
            "Weight": {
              "type": "integer"
            },
            "WeightUOM": {
              "type": "string"
            },
            "Width": {
              "type": "integer"
            },
            "FlagBirthDefects": {
              "type": "boolean"
            },
            "HasKitGroups": {
              "type": "boolean"
            },
            "FlagCancer": {
              "type": "boolean"
            },
            "PriceGroup": {
              "type": "integer"
            },
            "Images": {
              "type": "array"
            },
            "Prices": {
              "type": "array",
              "items": {
                "required": [
                  "GroupID",
                  "Price",
                  "PriceCurrency",
                  "OriginalPrice",
                  "Bonus",
                  "CV",
                  "QV",
                  "RewardPoints"
                ],
                "type": "object",
                "properties": {
                  "GroupID": {
                    "type": "integer"
                  },
                  "Price": {
                    "type": "integer"
                  },
                  "PriceCurrency": {
                    "type": "string"
                  },
                  "OriginalPrice": {
                    "type": "integer"
                  },
                  "Bonus": {
                    "type": "integer"
                  },
                  "CV": {
                    "type": "integer"
                  },
                  "QV": {
                    "type": "integer"
                  },
                  "RewardPoints": {
                    "type": "integer"
                  }
                }
              }
            },
            "Options": {
              "type": "array"
            },
            "ItemOptions": {
              "type": "array"
            },
            "Languages": {
              "type": "array",
              "items": {
                "required": [
                  "Description",
                  "LanguageCode",
                  "ProductName",
                  "SEOKeywords",
                  "Specifications"
                ],
                "type": "object",
                "properties": {
                  "Description": {
                    "type": "string"
                  },
                  "LanguageCode": {
                    "type": "string"
                  },
                  "ProductName": {
                    "type": "string"
                  },
                  "SEOKeywords": {
                    "type": "string"
                  },
                  "Specifications": {
                    "type": "string"
                  }
                }
              }
            },
            "OptionsMap": {
              "type": "array"
            },
            "HasOptions": {
              "type": "boolean"
            },
            "Price": {
              "type": "integer"
            },
            "PriceCurrency": {
              "type": "string"
            },
            "OriginalPrice": {
              "type": "integer"
            },
            "Bonus": {
              "type": "integer"
            },
            "CV": {
              "type": "integer"
            },
            "QV": {
              "type": "integer"
            },
            "RewardPoints": {
              "type": "integer"
            },
            "CouponsBeingUsed": {
              "type": "integer"
            },
            "StoreId": {
              "type": "integer"
            },
            "PriceGroups": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Custom": {
        "type": "object",
        "properties": {
          "Field1": {
            "type": "string"
          },
          "Field2": {
            "type": "string"
          },
          "Field3": {
            "type": "string"
          },
          "Field4": {
            "type": "string"
          },
          "Field5": {
            "type": "string"
          }
        }
      },
      "FrequencyString": {
        "type": "string"
      },
      "TotalCV": {
        "type": "integer"
      },
      "TotalQV": {
        "type": "integer"
      },
      "CurrencyCode": {
        "type": "string"
      },
      "SubTotal": {
        "type": "integer"
      }
    }
  },
  "example": [
    {
      "AutoShipID": 1,
      "AssociateID": 12,
      "AssociateFirstName": "Sam",
      "AssociateLastName": "Space",
      "ShipAddress": {
        "Street1": "1234 Test Dr.",
        "Street2": "Ste. 360",
        "City": "Placerville",
        "PostalCode": "95667",
        "Region": "CA",
        "CountryCode": "US"
      },
      "StartDate": "2021-10-27T16:19:08Z",
      "Frequency": 0,
      "LastProcessDate": "2021-10-27T00:00:00Z",
      "NextProcessDate": "2021-11-27T00:00:00Z",
      "LastChargeAmount": 10,
      "Status": "Scheduled",
      "ShipMethodDescription": "UPS 3-Day Shipping",
      "ShipMethodID": 3,
      "PaymentMethodID": "_TESTCARD_E0BNK54A65",
      "PaymentDescription": "Visa ending in 4321",
      "PaymentExpirationMonth": "10",
      "PaymentExpirationYear": "2026",
      "PaymentMerchantID": 99,
      "AutoShipType": 0,
      "LineItems": [
        {
          "ItemID": 4,
          "Quantity": 2,
          "Cost": 0,
          "ExtendedPrice": 20,
          "ExtendedOriginalPrice": 20,
          "ExtendedBonus": 0,
          "ExtendedCV": 10,
          "ExtendedQV": 8,
          "ExtendedRewardPoints": 0,
          "ExtendedCost": 0,
          "ProductName": "SLJ84L",
          "Description": "Language description here",
          "Specifications": "Specifications here",
          "SEO": "",
          "LanguageCode": "en",
          "SKU": "SLJ84L",
          "SkuID": 4,
          "Category": {
            "ID": 1,
            "CategoryTranslations": [
              {
                "Id": 1,
                "CategoryId": 1,
                "Description": "Test Category",
                "Name": "Test Category",
                "LanguageCode": "en"
              }
            ],
            "Name": "Test Category",
            "Description": "Test Category",
            "DisplayIndex": 0,
            "ImageUrl": "",
            "ParentID": 0,
            "ProductLineID": 0,
            "ShortDescription": "Test Category",
            "StoreIDs": [],
            "HasChildren": false
          },
          "ChargeShipping": true,
          "Custom": {
            "ItemId": 0,
            "Field1": "asdf",
            "Field2": "1234",
            "Field3": "L|M",
            "Field4": "1,2,3,4,5",
            "Field5": ""
          },
          "Height": 12,
          "Image": "/no_image.jpg",
          "Length": 6,
          "LengthUOM": "in",
          "MPN": "11-22-gg",
          "OutOfStockStatus": 1,
          "PackCount": 0,
          "PackageGroupID": 1,
          "TaxClassID": 0,
          "UnitOfMeasure": "ea",
          "UPC": "Test UPC",
          "Weight": 0,
          "WeightUOM": "",
          "Width": 0,
          "FlagBirthDefects": false,
          "HasKitGroups": false,
          "FlagCancer": true,
          "PriceGroup": 1,
          "Images": [],
          "Prices": [
            {
              "GroupID": 1,
              "Price": 10,
              "PriceCurrency": "USD",
              "OriginalPrice": 10,
              "Bonus": 0,
              "CV": 5,
              "QV": 4,
              "RewardPoints": 0
            }
          ],
          "Options": [],
          "ItemOptions": [],
          "Languages": [
            {
              "Description": "Language description here",
              "LanguageCode": "en",
              "ProductName": "SLJ84L",
              "SEOKeywords": "",
              "Specifications": "Specifications here"
            }
          ],
          "OptionsMap": [],
          "HasOptions": false,
          "Price": 10,
          "PriceCurrency": "USD",
          "OriginalPrice": 10,
          "Bonus": 0,
          "CV": 5,
          "QV": 4,
          "RewardPoints": 0,
          "CouponsBeingUsed": 0,
          "StoreId": 5,
          "PriceGroups": [
            1
          ]
        }
      ],
      "Custom": {
        "Field1": "asdf",
        "Field2": "1234",
        "Field3": "a,b,c",
        "Field4": "122|344",
        "Field5": ""
      },
      "FrequencyString": "Every Week on Wednesday",
      "TotalCV": 10,
      "TotalQV": 8,
      "CurrencyCode": "USD",
      "SubTotal": 20
    }
  ]
}

404 Not Found

A Customer with the given Customer ID was not found.

500 Internal Server Error

Something went wrong... Here are some possible reasons for this error:

  • Is the model being sent to the API incorrect?
  • Did you forget a required field?
  • Is the API marked as deprecated, and the date has expired?

If the answer is "No" to all of these questions, DirectScale could be experiencing technical difficulties. Please contact your DirectScale representative if the issue persists.

Code samples

@ECHO OFF

curl -v -X GET "https://dsapi.directscale.com/v1/customers/{customerId}/autoships?includeServiceAutoships=true"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            // Request parameters
            queryString["includeServiceAutoships"] = "true";
            var uri = "https://dsapi.directscale.com/v1/customers/{customerId}/autoships?" + queryString;

            var response = await client.GetAsync(uri);
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://dsapi.directscale.com/v1/customers/{customerId}/autoships");

            builder.setParameter("includeServiceAutoships", "true");

            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
            "includeServiceAutoships": "true",
        };
      
        $.ajax({
            url: "https://dsapi.directscale.com/v1/customers/{customerId}/autoships?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "GET",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://dsapi.directscale.com/v1/customers/{customerId}/autoships";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"includeServiceAutoships=true",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://dsapi.directscale.com/v1/customers/{customerId}/autoships');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'includeServiceAutoships' => 'true',
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_GET);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
    # Request parameters
    'includeServiceAutoships': 'true',
})

try:
    conn = httplib.HTTPSConnection('dsapi.directscale.com')
    conn.request("GET", "/v1/customers/{customerId}/autoships?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'includeServiceAutoships': 'true',
})

try:
    conn = http.client.HTTPSConnection('dsapi.directscale.com')
    conn.request("GET", "/v1/customers/{customerId}/autoships?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://dsapi.directscale.com/v1/customers/{customerId}/autoships')

query = URI.encode_www_form({
    # Request parameters
    'includeServiceAutoships' => 'true'
})

if uri.query && uri.query.length > 0
    uri.query += '&' + query
else
    uri.query = query
end

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body