Cancel Document
Changes the document state to canceled and updates the PDF.
POST https://bo.magnifinance.com/MagniAPI/Invoicing.asmx
Sample Body
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<DocumentCancel xmlns="http://MagniAPI/Invoicing/">
<Authentication>
<Email></Email>
<Token></Token>
</Authentication>
<DocumentId>68058</DocumentId>
</DocumentCancel>
</soap12:Body>
</soap12:Envelope>
Request
Header
| Parameter | Required | Value |
|---|---|---|
| Content-Type | required | text/xml |
Authentication
| Parameter | Required | Description |
|---|---|---|
| required | string(50) The API user with specific permission to create documents and get information about your own documents into a company. Example: api@magnifinance.com | |
| Token | required | The token of the subscription in which the document will be generated. |
Parameters
| Parameter | Required | Description |
|---|---|---|
| DocumentId | required | int Id of the document that you want to retrieve. Example value: "67053" |
Response
| Parameter | Description |
|---|---|
| Type | string Description to inform if the request was a success or error. Example value: "Success" |
| Object | DocumentGetOut |
| 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" |
Request Sample
Below you can see a few examples of the SOAP request in some technologies.
cURL
curl --location --request POST 'https://bo.magnifinance.com/MagniAPI/Invoicing.asmx' \
--header 'Content-Type: text/xml' \
--header 'Cookie: ARRAffinity=; ARRAffinitySameSite=' \
--data-raw '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentCancel>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentCancel>
</soap:Body>
</soap:Envelope>'
JavaScript (fetch)
var myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
myHeaders.append("Cookie", "ARRAffinity=; ARRAffinitySameSite=");
var raw = `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentCancel>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentCancel>
</soap:Body>
</soap:Envelope>`;
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://bo.magnifinance.com/MagniAPI/Invoicing.asmx", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Node.js (axios)
var axios = require('axios');
var data = `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentCancel>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentCancel>
</soap:Body>
</soap:Envelope>`;
var config = {
method: 'post',
url: 'https://bo.magnifinance.com/MagniAPI/Invoicing.asmx',
headers: {
'Content-Type': 'text/xml',
'Cookie': 'ARRAffinity=; ARRAffinitySameSite='
},
data: data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Example Response
Success
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentCancelResponse xmlns="http://MagniAPI/Invoicing/">
<Response>
<RequestId>1a02c786-54e2-4315-b36f-6996bb5d7634</RequestId>
<Type>Success</Type>
</Response>
</DocumentCancelResponse>
</soap:Body>
</soap:Envelope>
Error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentCancelResponse xmlns="http://MagniAPI/Invoicing/">
<Response>
<RequestId>15874aa7-d647-4e75-9834-b308f6a8a1f1</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>6</Value>
<Name>ElementDoesNotExist</Name>
</ErrorValue>
</Response>
</DocumentCancelResponse>
</soap:Body>
</soap:Envelope>