get https://secure.fusebill.com/v1/Customers//Purchases?query=field:queryString
This function is used to retrieve a list of purchase objects for a given customer ID.
Path Parameters
Property | Type | Description |
---|---|---|
customerId | Integer | This is the Id value of the Customer for whom you wish to retrieve the list of Purchases. |
This call supports string filtering (Read More) and datetime/numeric range filtering (Read More)
&query=parameterName:Value
Parameter Name | Acceptable Values | Parameter Name | Acceptable Values |
---|---|---|---|
Amount | Decimal Range | ModifiedTimestamp | Date Range |
CancellationTimestamp | Date Range | Name | String |
CreatedTimestamp | Date Range | PricingModelType | Standard, Tiered, Stairstep, Volume, Formula |
CustomerId | Integer | Product.Code | String |
Description | String | Product.Name | String |
EarningInterval | Monthly, Yearly | Product.Description | String |
EarningNumberOfInterval | Integer | PurchaseTimestamp | Date Range |
EarningTimingInterval | Daily, EarnImmediately, DoesNotEarn, Monthly, Yearly, Interval | Quantity | Decimal Range |
EarningTimingType | StartOfInterval, EndOfInterval, DoesNotEarn | SalesforceId | String |
EffectiveTimestamp | Date Range | Status | Draft, Purchased, Reversed, Cancelled |
IsEarnedImmediately | Boolean | TargetOrderQuantity | Decimal Range |
IsTrackingItems | Boolean | TaxableAmount | Decimal Range |
This call supports pagination (Read More)
&pageSize=100&pageNumber=0
This call supports sorting (Read More)
&sortOrder=Ascending
or &sortOrder=Descending
&sortExpression=expression
Examples
curl -X GET "https://secure.fusebill.com/v1/customers/{CustomerId}/Purchases" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//Path Parameter
int customerId = {CustomerId};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customers/" + customerId + "/Purchases");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + apiKey);
//Set request method
request.Method = "GET";
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in your URI and Headers
r = requests.get('https://secure.fusebill.com/v1/customers/{id}/purchases', headers=headers)
print(r.content)
Response
[
{
"customerId": 12762177,
"code": "device",
"effectiveTimestamp": "2019-11-11T19:39:55",
"taxableAmount": 15,
"amount": 15,
"modifiedTimestamp": "2019-11-11T19:40:07.963",
"salesforceId": "b045a250231VC4RCAW",
"netsuiteLocationId": "12",
"productId": 25309384,
"name": "Fitness Tracker",
"description": "Model 5000",
"status": "Purchased",
"quantity": 1,
"targetOrderQuantity": null,
"isTrackingItems": false,
"pricingModelType": "Standard",
"customFields": [],
"discounts": [],
"priceRanges": [
{
"min": 0,
"max": null,
"amount": 15,
"conditionAmount": null,
"variableAmount": null
}
],
"productItems": [],
"couponCodes": [],
"earningSettings": {
"earningInterval": "",
"earningNumberOfIntervals": null,
"earningTimingInterval": "EarnImmediately",
"earningTimingType": "StartOfInterval"
},
"id": 1616831,
"uri": "https://secure.fusebill.com/v1/Purchases/1616831"
}
]
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Bad request, the query is not valid. Please check your request and try again."
}
]
}