POST api/v1/CustomerBuyingReport

Retrieve a list of all items purchased by a specific customer over a date range
Data can be based on orders or invoices and over a variable number of months
Only items in stock or where the item wil be back in stock within n weeks

Request Information

URI Parameters

None.

Body Parameters

CustomerBuyingReportParams
NameDescriptionTypeAdditional information
apiKey

Please contact Caliq support to get your key

string

Required

CustomerID

The internal ID of the customer to get data for

integer

Required

AccountNo

The account number of the customer to get data for. ID will be used in preference to this if it is set

string

Required

Max length: 10

BasedOn

Should buying history be based on (O)rders placed or (I)nvoices sent?

string

Required

Max length: 1

MonthsBack

How many months back should be look at for the history

integer

Required

WeeksUntilAvailable

If we have no stock we will only include items whcih will be available again within n weeks. Can be 0 for unlimited window

integer

Required

Request Formats

application/json, text/json

Sample:
{
  "apiKey": "sample string 1",
  "CustomerID": 2,
  "AccountNo": "sample string 3",
  "BasedOn": "sample string 4",
  "MonthsBack": 5,
  "WeeksUntilAvailable": 6
}

application/xml, text/xml

Sample:
<CustomerBuyingReportParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <apiKey>sample string 1</apiKey>
  <CustomerID>2</CustomerID>
  <AccountNo>sample string 3</AccountNo>
  <BasedOn>sample string 4</BasedOn>
  <MonthsBack>5</MonthsBack>
  <WeeksUntilAvailable>6</WeeksUntilAvailable>
</CustomerBuyingReportParams>

Response Information

Resource Description

Returns:
200 OK Returns a collection of customer buying data
400 Bad Request - parameters supplied cannot be properly interpreted
401 Not Authorised if supplied api key is not valid
204 No Content if the requested customer did not buy anything or doesnt exist 503 Service Unavailable

CustomerBuyingReport
NameDescriptionTypeAdditional information
BuyingReportList

Collection of BuyingReportItem

None.

Response Formats

application/json, text/json

Sample:
{
  "BuyingReportList": [
    {
      "ID": 1,
      "Code": "sample string 2",
      "Description": "sample string 3",
      "CustPartNo": "sample string 4",
      "Barcode": "sample string 5",
      "EPOSBarcode": "sample string 6",
      "Qty": 7,
      "LastInvoiced": "sample string 8",
      "NextAvail": "sample string 9"
    },
    {
      "ID": 1,
      "Code": "sample string 2",
      "Description": "sample string 3",
      "CustPartNo": "sample string 4",
      "Barcode": "sample string 5",
      "EPOSBarcode": "sample string 6",
      "Qty": 7,
      "LastInvoiced": "sample string 8",
      "NextAvail": "sample string 9"
    }
  ]
}

application/xml, text/xml

Sample:
<BuyingReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <BuyingReportItem>
    <ID>1</ID>
    <Code>sample string 2</Code>
    <Description>sample string 3</Description>
    <CustPartNo>sample string 4</CustPartNo>
    <Barcode>sample string 5</Barcode>
    <EPOSBarcode>sample string 6</EPOSBarcode>
    <Qty>7</Qty>
    <LastInvoiced>sample string 8</LastInvoiced>
    <NextAvail>sample string 9</NextAvail>
  </BuyingReportItem>
  <BuyingReportItem>
    <ID>1</ID>
    <Code>sample string 2</Code>
    <Description>sample string 3</Description>
    <CustPartNo>sample string 4</CustPartNo>
    <Barcode>sample string 5</Barcode>
    <EPOSBarcode>sample string 6</EPOSBarcode>
    <Qty>7</Qty>
    <LastInvoiced>sample string 8</LastInvoiced>
    <NextAvail>sample string 9</NextAvail>
  </BuyingReportItem>
</BuyingReport>