Skip to main content

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

ParameterRequiredValue
Content-Typerequiredtext/xml

Authentication

ParameterRequiredDescription
Emailrequiredstring(50) The API user with specific permission to create documents and get information about your own documents into a company. Example: api@magnifinance.com
TokenrequiredThe token of the subscription in which the document will be generated.

Parameters

ParameterRequiredDescription
DocumentIdrequiredint Id of the document that you want to retrieve. Example value: "67053"

Response

ParameterDescription
Typestring Description to inform if the request was a success or error. Example value: "Success"
ObjectDocumentGetOut
ErrorMessagestring Unprocessed error message.
ErrorValueMagniEnum
Valueint Identifies the error with a number. To identify the types of errors in more detail, click here. Example value: "14"
Namestring Identifies the error with a token. Example value: "SaveFailed"
ErrorHumanReadablestring Text that explains the error found. Example value: "ValidationError"
ValidationErrorsList of ValidationError
Typestring Identifies the error with a token. Example value: "DocumentIsADuplicate"
Fieldstring Name of the field in which validation failed. Example value: "DocumentDetailExternalId"
Valuestring Value which failed validation. Example value: "6"
ElementNumberstring Identifies index of the field in which validation failed. Example value: "67204"
Detailstring 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>