API documentation Menu
GET https://bo.magnifinance.com/api/v1/document?documentId={DocumentId}
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 |
---|---|---|
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 | ||||||||||
|
|||||||||||
ErrorValue | MagniEnum | ||||||||||
|
|||||||||||
ErrorHumanReadable | string Text that explains the error found. Example value: "ValidationError" | ||||||||||
ValidationErrors | List of ValidationError | ||||||||||
|
|||||||||||
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
}