Skip to main content

Client Get

Get data about a partner that is already registered in MagniFinance. Example: Name, legal name, address, city, country name, country code, postal Code, phone number, email, IBAN.

POST https://bo.magnifinance.com/MagniAPI/invoicing.asmx

Request​

ParameterRequiredValue
Content-Typerequiredtext/xml

Body​

ClientGet​

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
Tokenrequiredstring(50) The token of the subscription in which the document will be generated.
Request Parameters​
ParameterRequiredDescription
TaxIdrequiredint Tax id of the partner organization that you want to get data. Example value: "599138645"
CountryCoderequiredstring(2) Client country. (To consult the code list for each country, access the link: ISO 3166-1 alpha-2). Example value: "PT"

Response​

ParameterDescription
RequestIdUnique Id for the request to have a way to identify the request
Typeint 0 = Success; 1 = Error; "Success" or "Error". Object will be returned on Success; ErrorValue, ErrorHumanReadable, ValidationErrors will be returned on Error. Example value: "0"
ObjectClient Information
NIF - string Partner Tax ID. Example: "166737755"
Name - string The commercial name of the company. Example: "MagniFinance"
Address - string The address of the company. Example: "Rua das Barreiras"
City - string The city of the company. Example: "Lisboa"
PostCode - string The postal code of the company. Example: "1000-000"
CountryCode - string Company country code in ISO 3166-1 alpha-2. Example: "PT"
PhoneNumber - string Company phone number. Example: "912345678"
CountryName - string Name of the country. Example value: "Portugal"
LegalName - string Partner organization legal name. Example value: "Magni EShop Partner"
Email - string The email of the company. Example value: "email@example.com"
IBAN - string Company international bank account number. Example value: "PT50002700000001234567833"
ErrorValueMagniEnum
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"
ValidationErrorsList of ValidationError
Type - string Identifies the error with a token. Example value: "DocumentIsADuplicate"
ElementNumber - string Identifies index of the field in which validation failed. Example value: "67204"
Field - string Name of the field in which validation failed. Example value: "DocumentDetailExternalId"
Detail - string Detailed error explanation. Example value: "Duplicate Document"

Request Sample​

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

cURL​

curl --location --request POST 'https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx' \
--header 'Content-Type: application/soap+xml; charset=utf-8' \
--data-raw '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:ClientGet>
<inv:Authentication>
<inv:Email>XXX@example.com</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:TaxId>XXX</inv:TaxId>
<inv:CountryCode>XX</inv:CountryCode>
</inv:ClientGet>
</soapenv:Body>
</soapenv:Envelope>'

JavaScript (fetch)​

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/soap+xml; charset=utf-8");

var raw = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:ClientGet>
<inv:Authentication>
<inv:Email>XXX@example.com</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:TaxId>XXX</inv:TaxId>
<inv:CountryCode>XX</inv:CountryCode>
</inv:ClientGet>
</soapenv:Body>
</soapenv:Envelope>`;

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

NodeJs (axios)​

var axios = require('axios');

var data = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:ClientGet>
<inv:Authentication>
<inv:Email>XXX@example.com</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:TaxId>XXX</inv:TaxId>
<inv:CountryCode>XX</inv:CountryCode>
</inv:ClientGet>
</soapenv:Body>
</soapenv:Envelope>`;

var config = {
method: 'post',
url: 'https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx',
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
},
data : data
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

Example Response​

Success​

<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>
<ClientGetResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseClientGet>
<RequestId>14be39b8-5dea-4a82-bf8b-7a1e4a48a69b</RequestId>
<Type>Success</Type>
<Object>
<NIF>123456789</NIF>
<Name>Empresa exemplar</Name>
<Address>Rua das Barreiras</Address>
<City>Lisboa</City>
<PostCode>1234-567</PostCode>
<CountryCode>PT</CountryCode>
<PhoneNumber>999999999</PhoneNumber>
<CountryName>Portugal</CountryName>
<LegalName>Empresa Exemplar lda</LegalName>
<Email>email@exemplo.com</Email>
<IBAN>PT50002700000001234567833</IBAN>
</Object>
</ResponseClientGet>
</ClientGetResponse>
</soap:Body>
</soap:Envelope>

Error​

<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>
<ClientGetResponse xmlns="http://MagniAPI/Invoicing/">
<ResponseClientGet>
<RequestId>7a3db77d-20d5-4eae-a6ef-58471c3f6e8a</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>2</Value>
<Name>ValidationError</Name>
</ErrorValue>
<ValidationErrors>
<ValidationError>
<Type>InvalidTaxId</Type>
<ElementNumber>0</ElementNumber>
<Field>TaxId</Field>
<Detail>Invalid Tax Id</Detail>
</ValidationError>
</ValidationErrors>
</ResponseClientGet>
</ClientGetResponse>
</soap:Body>
</soap:Envelope>