get https://secure.fusebill.com/v1/PurchaseDiscounts/
The following request returns a single product discount by using the Fusebill generated ID
Path Parameters
Property | Type | Description |
---|---|---|
purchaseDiscountId | Integer | Fusebill generated ID uniquely identifying the purchase discount |
Example
curl –X GET https://secure.fusebill.com/v1/PurchaseDiscounts/{purchaseDiscountID} \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//setup purchase discount ID
Int purchaseDiscountID = {purchaseDiscountID}
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/PurchaseDiscounts/" + purchaseDiscountID);
//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 JSON
import json
#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/PurchaseDiscounts/{purchaseDiscountID}', headers=headers)
print(r.content)
Response
{
"purchaseId": 845323,
"discountType": "Percentage",
"amount": 10,
"id": 598462,
"uri": "https://secure.fusebill.com/v1/purchasediscounts/598462"
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "PurchaseDiscount with id 12 not found."
}
]
}