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.
GET https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId={partnerTaxId}
Request
Header
Parameter |
Required |
Value |
Email |
required |
string(50) The email address of the owner of the IPPN service with specific permissions to use IPPN services. Example: api@example.com
|
Token |
required |
The token for the IPPN account is specific to your IPPN service and is provided by our commercial team. |
Password |
required |
The password of the user that was set up to be the main user of your IPPN service.
|
*These parameters must be an HTTP headers within the request.
Query
Parameter |
Required |
Description |
partnerTaxId |
required |
int Tax id of the partner organization whose tokens will be retrieved. Example value: "599138645" In the REST API you should request as a query string parameter in the URL. Example: ?partnerTaxId=599138645
|
Response
Parameter |
Description |
RequestId |
Unique Id for the request to have a way to identify the request |
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.
|
|
Type |
string Description to inform if the request was a success or error. Example value: "Success"
|
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"
|
|
IsSuccess |
boolean Whether the request succeeded or not. Example value: "true"
|
IsError |
boolean Whether the request failed or not. Example value: "false"
|
Request Sample
Below you can check some examples of the REST request in some technologies.
cURL
curl --location 'https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX' \
--header 'Email: XXX@example.com' \
--header 'Token: XXX' \
--header 'password: XXX' \
Javascript (fetch)
var myHeaders = new Headers();
myHeaders.append("Email", "XXX@example.com");
myHeaders.append("Token", "XXX");
myHeaders.append("password", "XXX");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
NodeJs (axios)
var axios = require('axios');
var config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX',
headers: {
'Email': 'XXX@example.com',
'Token': 'XXX',
'password': 'XXX',
}
};
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).