Getting Started - Manual Setup explains how to use an Acquisio API with Postman.
Unlike the default Getting Started guide, this guide doesn’t use the OpenAPI import or the OAuth support of Postman.
If you have any question, you can send an email to api@acquisio.com.
Generating an access token
The Acquisio APIs are secured with OAuth 2.0. The OAuth grant type is Client Credentials.
The Client Application (in this case, it’s Postman) must send the clientId and the clientSecret
separated by a :
encoded in Base 64. The format will be like: Base64(clientId:clientSecret)
Many variants of Base64 exist. The variant that must be used is RFC 4648. Line wrapping should be disabled.
The example below shows how to encode the clientId and clientSecret in Java. Examples in other programming languages are also available.
// Java uses RFC 4648 by default
java.util.Base64.Encoder encoder = java.util.Base64.getEncoder();
String clientIdAndSecret = clientId + ":" + clientSecret;
encodedClientIdAndSecret = encoder.encodeToString(clientIdAndSecret.getBytes("UTF-8"));
A POST request needs to be created to request the access token with the clientId and clientSecret. To create this request in Postman:
- Create a
POST
request with the URL https://api.acquisio.com/token - In the “Headers” tab, add a header named
Content-Type
with the valueapplication/x-www-form-urlencoded
- In the “Headers” tab, add a header named
Authorization
with the valueBasic Base64(clientId:clientSecret)
, whereBase64(clientId:clientSecret)
must be replaced with the values for your Acquisio agency.
- In the “Body” tab, add a key named
grant_type
with the valueclient_credentials
The response includes an access token and specifies the expiration time of the token in seconds. There’s no refresh token for the Client Credentials grant type, since the client application can generate a new Access token without having to ask a user for its credentials.
{
"access_token": "a6bba16f-c08c-3f8c-8af6-6ff5c88643cb",
"scope": "am_application_scope default",
"token_type": "Bearer",
"expires_in": 2550
}
Calling an API endpoint
When an API endpoint is called, the Authorization
header must be sent with Bearer AccessToken
where AccessToken
is an access token returned by https://api.acquisio.com/token
A call to GET /provisioning/v0/accounts allows to retrieve the Acquisio accounts of an agency. To call this endpoint, the following request needs to be created in Postman:
- Create a
GET
request with the URL https://api.acquisio.com/provisioning/v0/accounts - In the “Headers” tab, add a header named
Authorization
with the valueBearer AccessToken
(AccessToken
needs to be replaced by a valid access token)
A JSON response will be returned with the accounts.
{
"accounts": [
{
"id": 30345185874,
"name": "Test Account",
"language": "en",
"country": "CA",
"currency": "CAD",
"notes": null,
"autoImport": true,
"field1": null,
"field2": null,
"field3": null,
"field4": null,
"field5": null,
"field6": null,
"field7": null,
"field8": null,
"field9": null,
"field10": null,
"field11": null,
"field12": null,
"field13": null,
"field14": null,
"field15": null,
"field16": null,
"field17": null,
"field18": null,
"field19": null,
"field20": null,
"field21": null,
"field22": null,
"field23": null,
"field24": null,
"field25": null,
"field26": null,
"field27": null,
"field28": null,
"field29": null,
"field30": null,
"linkedAdPlatformAccounts": [
{
"id": 30545139954,
"name": "Google Ads Test Account",
"adPlatformType": "GoogleAds",
"status": "ReadWrite",
"adPlatformId": "204345345063"
}
]
}
]
}
Encoding URL reserved characters
URL reserved characters must be encoded. For example, a request with the following query parameter filter=statistics.clicks:[1 TO *]
needs to be encoded as filter=statistics.clicks%3A%5B1%20TO%20*%5D
. Otherwise, a 400 error will be returned by the API.
This can be done in Postman by clicking on the Params
button to open a grid with the query parameters. Right-click on the
query parameter value to encode, then select in the menu “EncodeURIComponent”. EncodeURIComponent
will convert a value like
filter=statistics.clicks:[1 TO *]
to filter=statistics.clicks%3A%5B1%20TO%20*%5D
. DecodeURIComponent
can be used to convert
from filter=statistics.clicks%3A%5B1%20TO%20*%5D
to filter=statistics.clicks:[1 TO *]
.
For more information about encoding in Postman, refer to the Postman official documentation.