Download invoice
Information
This endpoint allow you to download original document iopole received. It can be a pdf as a factur-x
or a pure xml CII
, UBL
or custom format..
This endpoint is
synchronous
The role
user
is needed in order to use this endpointEndpoints
GET/v1/invoice/:invoiceId/download
Path parameters
invoiceIdstring (uuid) - Required
Request
GET /v1/invoice/:invoiceId/download
- bash
- javascript
- .NET
curl -X 'GET'
'https://api.ppd.iopole.fr//v1/invoice/5e80a8b6-06b5-4c52-853a-c5c2e252a2fc/download'
-H 'accept: application/pdf'
-H 'Authorization: Bearer ${token}'
const got = require('got');
const token = 'your_token_here';
const invoiceId = '5e80a8b6-06b5-4c52-853a-c5c2e252a2fc';
(async () => {
try {
const response = await got(`https://api.ppd.iopole.fr//v1/invoice/${invoiceId}/download`, {
headers: {
'accept': 'application/pdf',
'Authorization': `Bearer ${token}`,
},
responseType: 'buffer', // Use buffer for binary data
});
// Save the PDF to a file
const fs = require('fs');
fs.writeFileSync('invoice.pdf', response); // Save response to invoice.pdf
console.log('Invoice downloaded as invoice.pdf');
} catch (error) {
console.error(error.response.body);
}
})();
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var token = "your_token_here";
var invoiceId = "5e80a8b6-06b5-4c52-853a-c5c2e252a2fc";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("accept", "application/pdf");
client.DefaultRequestHeaders.Add("Authorization", "Bearer ${token}");
try
{
var response = await client.GetAsync("https://api.ppd.iopole.fr//v1/invoice/{invoiceId}/download");
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsByteArrayAsync();
await File.WriteAllBytesAsync("invoice.pdf", content); // Save the content to invoice.pdf
Console.WriteLine("Invoice downloaded as invoice.pdf");
}
catch (HttpRequestException ex)
{
Console.WriteLine("Request error: {ex.Message}");
}
}
}
Response
200 - content-type: application/pdf