Get a Document Property
Returns one property of a document. Today the only property available is the payment status: whether the document is paid, and how much is still unpaid.
POST https://bo.magnifinance.com/MagniAPI/Invoicing.asmx
Sample Body
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:DocumentGetProperty>
<inv:Authentication>
<inv:Email>api@yourcompany.pt</inv:Email>
<inv:Token>your-subscription-token</inv:Token>
</inv:Authentication>
<inv:DocumentId>72609</inv:DocumentId>
<inv:DocumentProperty>paymentstatus</inv:DocumentProperty>
</inv:DocumentGetProperty>
</soapenv:Body>
</soapenv:Envelope>
Request
Header
| Parameter | Required | Value |
|---|---|---|
| Content-Type | required | text/xml; charset=utf-8 |
| SOAPAction | optional | "http://MagniAPI/Invoicing/DocumentGetProperty" |
Authentication
| Parameter | Required | Description |
|---|---|---|
| required | string(50) The email of an API user of your company with permission to read documents. Example: api@yourcompany.pt | |
| Token | required | string(50) The token of the company (subscription) the document belongs to. |
Parameters
| Parameter | Required | Description |
|---|---|---|
| DocumentId | required | int The id of the document, as returned by DocumentCreate. Example: 72609 |
| DocumentProperty | required | string The property to read. The only value accepted is paymentstatus (upper or lower case). Any other value returns the error InvalidDocumentProperty. |
Response
The result is in <ResponseDocumentGetProperty> (not <Response>); see Response Format for the fields every response has. Object holds:
| Parameter | Description |
|---|---|
| PaymentStatus | string NoPayment, Incomplete or Complete (see below). |
| TotalAmount | string The document total, as text in Portuguese format (comma as decimal separator). Example: "69,75" |
| UnpaidAmount | string How much is still unpaid, in the same format. "0,00" once the document is fully paid, whether through a bank reconciliation or because it was marked as paid. Example: "20,00" |
The other fields of this object (DocumentNumber, DownloadUrl, Details) are not filled in here; use DocumentGet for those.
Payment Status Values
| Status | Description |
|---|---|
| NoPayment | No payment has been registered for this document. |
| Incomplete | Part of the document has been paid; UnpaidAmount shows the rest. |
| Complete | The document is fully paid. |
Request Sample
Save the Sample Body as request.xml, then:
cURL
curl https://bo.magnifinance.com/MagniAPI/Invoicing.asmx \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: "http://MagniAPI/Invoicing/DocumentGetProperty"' \
--data-binary @request.xml
JavaScript (Node.js 18+)
const fs = require('fs');
const body = fs.readFileSync('request.xml', 'utf8');
fetch('https://bo.magnifinance.com/MagniAPI/Invoicing.asmx', {
method: 'POST',
headers: {
'Content-Type': 'text/xml; charset=utf-8',
SOAPAction: '"http://MagniAPI/Invoicing/DocumentGetProperty"',
},
body,
})
.then((response) => response.text())
.then((xml) => console.log(xml))
.catch((error) => console.error(error));
Example Response
Success
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetPropertyResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseDocumentGetProperty>
<RequestId>3f04f766-c3fe-4ede-a399-8f2a0ae1f3dc</RequestId>
<Type>Success</Type>
<Object>
<PaymentStatus>Complete</PaymentStatus>
<TotalAmount>69,75</TotalAmount>
<UnpaidAmount>0,00</UnpaidAmount>
</Object>
</ResponseDocumentGetProperty>
</DocumentGetPropertyResponse>
</soap:Body>
</soap:Envelope>
Error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetPropertyResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseDocumentGetProperty>
<RequestId>bd0e8cf2-5bfa-4b4a-9226-e148d1d81e87</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>24</Value>
<Name>InvalidDocumentProperty</Name>
</ErrorValue>
</ResponseDocumentGetProperty>
</DocumentGetPropertyResponse>
</soap:Body>
</soap:Envelope>