Nova aplicação de telemóvel | Experimente grátis!
Faturar no iphone com MagniFinance. Aceda ao link da Apple store Faturar no Android com MagniFinance. Aceda ao link para Android Store
 
API documentation Menu

API 2.0 | Go to the latest documentation arrow_forward

Get a Document


Retrieves a document PDF download URL. Only applicable to documents in closed/ canceled state.



GET https://bo.magnifinance.com/api/v1/document?documentId={DocumentId}


Request

Header

Parameter Required Value
Email required The API user with specific permission to create documents into the company. Example: api@magnifinance.com
Token required The token of the subscription in which the document will be generated.

*These parameters must be an HTTP headers within the request.



Query

Parameter Required Description
DocumentId required int Id of the document that you want to retrieve. Example value: "67053" In the REST API you should request as a query string parameter in the URL. Example: ?documentId=47257



Response

Parameter Description
Type int 0 = Success; 1 = Error; “Success” or “Error”. Object will be returned on Success; ErrorValue, ErrorHumanReadable, ValidationErrors will be returned on Error. Example value: Example value: "0"
Object DocumentGetOut
DocumentNumber string The document’s sequence number in the series. Example value: "FT FT/47"
DownloadUrl string The document’s sequence number in the series. Example value: "https://magnifilesdev.s3.eu-west-1.amazonaws.com/18471/2022/d26b0727-fc66-4353-9047-eae50c3a896b.pdf?X-Amz-Expires=7200&response-cache-control=No-cache&response-content-disposition=attachment%3B%20filename%3DFTFT_47_companySprint47APItest_2022-04-04_BRL0%252c00.pdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3INGX4GEGE7JUSA/20220405/eu-west-1/s3/aws4_request&X-Amz-Date=20220405T171024Z&X-Amz-SignedHeaders=host&X-Amz-Signature=786256202dc32a0be27144ef63db98f6f35ed45fc5d9a06545d14f03edc07495"
ErrorMessage string Unprocessed error message.
ErrorValue MagniEnum
Value int Identifies the error with a number. To identify the types of errors in more detail, click here Example value: "14"
Name string Identifies the error with a token. Example value: "SaveFailed"
ErrorHumanReadable string Text that explains the error found. Example value: "ValidationError"
ValidationErrors List of ValidationError
Type string Identifies the error with a token. Example value: "DocumentIsADuplicate"
Field string Name of the field in which validation failed. Example value: "DocumentDetailExternalId"
Value string Value which failed validation. Example value: "6"
ElementNumber string Identifies index of the field in which validation failed. Example value: "67204"
Detail string detailed error explanation. Example value: "Duplicate Document"
IsError boolean Whether the request failed or not. Example value: "false"
IsSuccess boolean Whether the request succeeded or not. Example value: "true"


Request Sample

Below you can check some examples of the REST request in some technologies.


cURL

curl --location --request GET 'https://bo.magnifinance.com/api/v1/document?documentId={DOCUMENTID}' \ --header 'email: ' \ --header 'token: ' \


Javascript (fetch)

var myHeaders = new Headers(); myHeaders.append("email", ""); myHeaders.append("token", ""); myHeaders.append("Cookie", "ARRAffinity=; ARRAffinitySameSite="); var raw = ""; var requestOptions = { method: 'GET', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://bo.magnifinance.com/api/v1/document?documentId={DOCUMENTID}", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));


NodeJs (axios)

var axios = require('axios'); var data = ''; var config = { method: 'get', url: 'https://bo.magnifinance.com/api/v1/document?documentId={DOCUMENTID}', headers: { 'email': '', 'token': '', 'Cookie': 'ARRAffinity=371664b7844380fdfa1d014fd32f66a907959f6adda6dfaf4e6658b4cc8cc474; ARRAffinitySameSite=371664b7844380fdfa1d014fd32f66a907959f6adda6dfaf4e6658b4cc8cc474' }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });


Example Response

Success

{ "RequestId": "7803c137-5b85-45f8-be08-dac89c177c37", "Object": { "DocumentNumber": "FT FT/1", "DownloadUrl": "https://magnifilesdev.s3.eu-west-1.amazonaws.com/18471/2022/a8966b10-71b2-4326-99c2-cf5bce88a94d.pdf?X-Amz-Expires=7200&response-cache-control=No-cache&response-content-disposition=attachment%3B%20filename%3DFTFT_1_companySprint47APItest_2022-03-31_EUR2%252c96.pdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3INGX4GEGE7JUSA/20220405/eu-west-1/s3/aws4_request&X-Amz-Date=20220405T101954Z&X-Amz-SignedHeaders=host&X-Amz-Signature=7e5fa717339dfa63d87615e37829eeb420364ed6f5f85c00522abd556b98d2b0", "PaymentStatus": null, "ErrorMessage": null, "TotalAmount": null, "UnpaidAmount": null }, "Type": 0, "ErrorValue": null, "ErrorHumanReadable": null, "ValidationErrors": null, "IsSuccess": true, "IsError": false }


Error

{ "RequestId": "dc5983e0-a93c-4690-a2c4-4379978382fd", "Object": null, "Type": 1, "ErrorValue": { "Value": 6, "Name": "ElementDoesNotExist" }, "ErrorHumanReadable": null, "ValidationErrors": null, "IsSuccess": false, "IsError": true }

Este site usa cookies para melhorar o desempenho e experiência. Ao continuar, declara aceitar todos os cookies. Fechar