get https://secure.fusebill.com/v1/draftInvoices/pdf/?showTrackedItems=true/false
This API endpoint allow you to retrieve a draft invoice by draft invoice id.
Path Parameter
Parameter | Type | Description |
---|---|---|
DraftInvoiceId | Integer | The ID of the invoice you want to retrieve. |
URL Parameter
Parameter | Type | Description |
---|---|---|
showTrackedItems | Boolean | When set to true, this option will tell Fusebill to return details of any tracked items which are set to be purchased on this invoice. |
Throttled Endpoint
Where possible, please use Read Draft Invoice as HTML instead of this endpoint. The HTML version is far more responsive, less demanding, and will provide similar results.
Examples
curl -X GET "https://secure.fusebill.com/v1/draftInvoices/pdf/{Id}?showTrackedItems=false" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}"
//query parameter
bool showTrackedItems = false;
int invoiceId = {Id};
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/draftInvoices/pdf/" + invoiceId + "?showTrackedItems=" + showTrackedItems);
//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/pdf/{Id}?showTrackedItems=false', headers=headers)
Response
Upon success, a PDF file is returned. This is the same PDF which is emailed to customers from the Fusebill Administrative system.
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "DraftInvoice with id 1 not found."
}
]
}