Como encontrar arquivos da nota fiscal
Endpoint
GET /api/v1/invoice/{id}/pdf
GET /api/v1/invoice/{id}/xml
Você encontra a documentação mais detalhada desse endpoint nas documentações de api
Para buscar os arquivos de uma nota fiscal específica você pode apenas buscar utilizando os endpoints listados acima, ambos devem retornar um arquivo correspondente pdf ou xml de acordo com a requisição
Erros mapeados
Invoice not found
Error while getting invoice documents
Exemplos em código
- Shell + cURL
- JavaScript + Fetch
curl --request GET \
--url https://api.woovi.com/api/v1/invoice/{id}/pdf \
--header 'Authorization: {AUTHORIZATION TOKEN}' \
--header 'content-type: application/json'
fetch('https://api.woovi.com/api/v1/invoice/{id}/pdf', {
method: 'GET',
headers: {
Authorization: {AUTHORIZATION TOKEN},
'Content-Type': 'application/json',
},
}).then(async (res) => {
const contentType = res.headers.get('Content-Type');
if (contentType?.includes('application/pdf')) {
const blob = await res.blob();
const url = URL.createObjectURL(blob);
return { pdfUrl: url };
}
if (contentType?.includes('application/json')) {
return res.json();
}
return res.text();
})