API 2.1
GetPartnerAccessTokens
The GetPartnerAccessTokens gives access to all the partnersTokens that give you access to invoicing in the behalf of them.
A partner can be allocated with more than one token. This allows a partner to be identified in more than one identifier, if needed.
OBS: This is the only method that requires the password of the main API user of IPPN service.
Passwords must be securely stored, ideally on a separate system from the system used for the rest of the operations.
POST https://bo.magnifinance.com/MagniAPI/Invoicing.asmx
Sample Body
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:GetPartnerAccessTokens>
<inv:SpecialAuthentication>
<inv:Email>{{userPartnership}}</inv:Email>
<inv:Token>{{tokenPartnership}}</inv:Token>
<inv:Password>{{basePassword}}</inv:Password>
</inv:SpecialAuthentication>
<inv:PartnerTaxId>992281008</inv:PartnerTaxId>
</inv:GetPartnerAccessTokens>
</soap:Body>
</soap:Envelope>
Request
Header
Parameter |
Required |
Value |
Content-Type |
required |
text/xml
|
Body
SpecialAuthentication
Parameter |
Required |
Value |
Email |
required |
string Platform automation user email.
|
Token |
required |
string(50) The token of the subscription in which the document will be generated.
|
Password |
required |
string(200) Access password.
|
Parameter |
Required |
Value |
CompanyTaxId |
required |
string(20) Tax id of the partner organization whose tokens will be retrieved. Example value: "599138645"
|
Response
Parameter |
Description |
Type |
string Description to inform if the request was a success or error. Example value: "Success"
|
Object |
List of APIAccessTokenBase
|
|
AccessToken |
string Security token that provides access to the requested partner organization’s subscription.
|
Description |
string Description that can be used to differentiate between tokens.
|
|
ErrorValue |
MagniEnum
|
|
Value |
int Identifies the error with a number. To identify the types of errors in more detail, click here Example value: "38"
|
Name |
string Identifies the error with a token. Example value: "PartnershipNotFound"
|
|
ErrorHumanReadable |
string Text that explains the error found. Example value: "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"
|
ElementNumber |
int 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 check some examples of the SOAP request in some technologies.
cURL
--header 'Content-Type: text/xml' \
--data-raw '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:GetPartnerAccessTokens>
<!--Optional:-->
<inv:SpecialAuthentication>
<!--Optional:-->
<inv:Email> </inv:Email>
<!--Optional:-->
<inv:Token> </inv:Token>
<!--Optional:-->
<inv:Password> </inv:Password>
</inv:SpecialAuthentication>
<!--Optional:-->
<inv:PartnerTaxId> </inv:PartnerTaxId>
</inv:GetPartnerAccessTokens>
</soap:Body>
</soap:Envelope>'
Javascript (fetch)
var myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
var raw = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:inv=\"http://MagniAPI/Invoicing/\">\r\n <soap:Header/>\r\n <soap:Body>\r\n <inv:GetPartnerAccessTokens>\r\n <!--Optional:-->\r\n <inv:SpecialAuthentication>\r\n <!--Optional:-->\r\n <inv:Email>{{userPartnership}}</inv:Email>\r\n <!--Optional:-->\r\n <inv:Token>{{tokenPartnership}}</inv:Token>\r\n <!--Optional:-->\r\n <inv:Password>{{basePassword}}</inv:Password>\r\n </inv:SpecialAuthentication>\r\n <!--Optional:-->\r\n <inv:PartnerTaxId>992281008</inv:PartnerTaxId>\r\n </inv:GetPartnerAccessTokens>\r\n </soap:Body>\r\n</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));
NodeJs (axios)
var axios = require('axios');
var data = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">\r\n <soap:Header/>\r\n <soap:Body>\r\n <inv:GetPartnerAccessTokens>\r\n <!--Optional:-->\r\n <inv:SpecialAuthentication>\r\n <!--Optional:-->\r\n <inv:Email>{{userPartnership}}</inv:Email>\r\n <!--Optional:-->\r\n <inv:Token>{{tokenPartnership}}</inv:Token>\r\n <!--Optional:-->\r\n <inv:Password>{{basePassword}}</inv:Password>\r\n </inv:SpecialAuthentication>\r\n <!--Optional:-->\r\n <inv:PartnerTaxId>992281008</inv:PartnerTaxId>\r\n </inv:GetPartnerAccessTokens>\r\n </soap:Body>\r\n</soap:Envelope>';
var config = {
method: 'post',
url: 'https://bo.magnifinance.com/MagniAPI/Invoicing.asmx',
headers: {
'Content-Type': 'text/xml'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Important informations
With the token in hand, you can use it, call the DocumentCreate method, replacing the token in the authentication/header with the partnerToken (so you can create a document on behalf of the partner).