Getting Started with curl

Getting Started with curl explains how to use an Acquisio API with curl. curl is a command line tool that can be used to test the REST APIs of Acquisio API.

If you prefer to use an application with a UI, see Getting Started.

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 sends 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.

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 can be sent with curl to request the access token with the clientId and clientSecret.

curl -d "grant_type=client_credentials" \
        -H "Authorization: Basic xzzflprEA8yC2K6AUZKZoZMw_fMa:3gyrfVH8CMZWiQgy5u0lSMPrmlAa" \
        -H "Content-Type: application/x-www-form-urlencoded" \
         https://api.acquisio.com/token

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.

curl -H "Authorization: Bearer a6bba16f-c08c-3f8c-8af6-6ff5c88643cb" \
         https://api.acquisio.com/provisioning/v0/accounts

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": "AdWords Test Account",
          "adPlatformType": "AdWords",
          "status": "ReadWrite",
          "adPlatformId": "204345345063"
        }
      ]
    }
  ]
}