get https://secure.fusebill.com/v1/DraftInvoices/?groupCharges=
This action allows you to retrieve a single draft invoice by its Fusebill generated ID.
Path Parameters
Property | Type | Description |
---|---|---|
draftInvoiceId | Integer | The ID of the invoice you want to retrieve. |
URL Parameters
Property | Type | Description | Required |
---|---|---|---|
groupCharges | Boolean | Groups charges into charge groups. Charges are grouped by subscription or purchase. For charge groups that result from a subscription, this returns the related subscriptionId in the JSON. False by default. | Optional |
Examples
curl -X GET "https://secure.fusebill.com/v1/DraftInvoices/{draftInvoiceId}" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//query parameter
int draftInvoiceId = {draftInvoiceId};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/DraftInvoices/" + draftInvoiceId);
//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/DraftInvoices/{id}', headers=headers)
print(r.content)
Response
{
"billingPeriodId": 319876,
"effectiveTimestamp": "2017-06-12T19:51:57",
"status": "Ready",
"poNumber": null,
"draftCharges": [
{
"transactionId": 0,
"chargeTypeId": null,
"transactionType": "Charge",
"quantity": 8,
"unitPrice": 39.875,
"amount": 319,
"taxableAmount": 319,
"subscriptionPeriodId": 0,
"draftInvoiceId": 0,
"name": "Tiered product",
"description": null,
"effectiveTimestamp": "2017-06-12T19:52:11",
"proratedUnitPrice": null,
"startServiceDate": "2017-06-12T19:52:11",
"endServiceDate": "2017-06-25T04:00:00",
"rangeQuantity": null,
"draftDiscount": null,
"draftDiscounts": [
],
"status": "Active",
"productItems": null,
"canProrateCharge": true,
"postable": true,
"draftChargeTiers": [
{
"label": "0-2",
"quantity": 2,
"unitPrice": 22,
"amount": 44,
"sortOrder": 1
},
{
"label": ">2-4",
"quantity": 2,
"unitPrice": 33,
"amount": 66,
"sortOrder": 2
},
{
"label": ">4-5",
"quantity": 1,
"unitPrice": 44,
"amount": 44,
"sortOrder": 3
},
{
"label": ">5",
"quantity": 3,
"unitPrice": 55,
"amount": 165,
"sortOrder": 4
}
],
"id": 1669985,
"uri": null
}
],
"subtotal": 319,
"totalDiscount": 0,
"total": 319,
"taxes": [
],
"paymentSchedules": [
],
"customer": {
"reference": null,
"companyName": null,
"fullName": "John Smith",
"contactName": null,
"primaryPhone": null,
"primaryEmail": null,
"billingAddress": null,
"shippingAddress": null,
"invoicePreference": {
"signature": "<p><img src=\"https://fbhostedpagesdev.blob.core.windows.net/local/logo-1614-636308250333322560.png\" alt=\"mattLtest\"> <strong>mattLtest</strong> \n</p>\n<p><em>mattLtest | | [][1]</em></p>\n<p>[1]: </p>\n",
"standingPoNumber": null,
"invoiceNotes": "api test"
}
},
"notes": null,
"shippingInstructions": null,
"customerReferenceValue": "",
"terms": "Net10",
"id": 294308,
"uri": "https://secure.fusebill.com/v1/DraftInvoices/{ID}"
}
{
"billingPeriodId": 319876,
"effectiveTimestamp": "2017-06-12T19:51:57",
"status": "Ready",
"poNumber": null,
"draftChargeGroups": [
{
"name": "Bronze",
"description": "The Bronze Plan",
"reference": "My custom reference for the Bronze Plan",
"subscriptionId": 301069,
"draftCharges": [
{
"transactionId": 0,
"chargeTypeId": null,
"transactionType": "Charge",
"quantity": 8,
"unitPrice": 39.875,
"amount": 319,
"taxableAmount": 319,
"subscriptionPeriodId": 0,
"draftInvoiceId": 0,
"name": "Tiered product",
"description": null,
"effectiveTimestamp": "2017-06-12T19:52:11",
"proratedUnitPrice": null,
"startServiceDate": "2017-06-12T19:52:11",
"endServiceDate": "2017-06-25T04:00:00",
"rangeQuantity": null,
"draftDiscount": null,
"draftDiscounts": [],
"status": "Active",
"productItems": null,
"canProrateCharge": true,
"postable": true,
"draftChargeTiers": [
{
"label": "0-2",
"quantity": 2,
"unitPrice": 22,
"amount": 44,
"sortOrder": 1
},
{
"label": ">2-4",
"quantity": 2,
"unitPrice": 33,
"amount": 66,
"sortOrder": 2
},
{
"label": ">4-5",
"quantity": 1,
"unitPrice": 44,
"amount": 44,
"sortOrder": 3
},
{
"label": ">5",
"quantity": 3,
"unitPrice": 55,
"amount": 165,
"sortOrder": 4
}
],
"id": 1669985,
"uri": null
}
]
}
],
"subtotal": 319,
"totalDiscount": 0,
"total": 319,
"taxes": [],
"paymentSchedules": [],
"customer": {
"reference": null,
"companyName": null,
"fullName": "John Smith",
"contactName": null,
"primaryPhone": null,
"primaryEmail": null,
"billingAddress": null,
"shippingAddress": null,
"invoicePreference": {
"signature": "<p><img src=\"https://fbhostedpagesdev.blob.core.windows.net/local/logo-1614-636308250333322560.png\" alt=\"mattLtest\"> <strong>mattLtest</strong> \n</p>\n<p><em>mattLtest | | [][1]</em></p>\n<p>[1]: </p>\n",
"standingPoNumber": null,
"invoiceNotes": "api test"
}
},
"notes": null,
"shippingInstructions": null,
"customerReferenceValue": "",
"terms": "Net10",
"id": 294308,
"uri": "https://secure.fusebill.com/v1/DraftInvoices/{ID}"
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "DraftInvoice with id 1 not found."
}
]
}