An Object Oriented wrapper for the Adobe Marketing Cloud APIs

2.1.2 2018-03-27 19:03 UTC

This package is auto-updated.

Last update: 2024-05-29 03:27:39 UTC


Build Status

A simple, Object Oriented wrapper for the Adobe Marketing Cloud APIs written in PHP5. This library is modeled after the php-github-api library built by ornicar

Uses the Adobe Marketing Cloud APIs. Default version is 1.4, but 1.3 and 1.2 are compatible.


  • PHP 5.3 or higher
  • php curl but it is possible to write another transport layer..

If the method you need does not exist yet, don't hesitate to request it with an issue!


The first step to use include the library via composer:

require_once '/vendor/autoload.php';

Instantiate a new AdobeMarketingCloud Client

$adm = new AdobeMarketingCloud\Client();

From this object you can now access all of the different AdobeMarketingCloud APIs (listed below)

Authenticate a user

Authenticate using your Adobe Digital Marketing Web Services username and secret. You can obtain one by logging into the Marketing Cloud and browsing to Admin > Company > Web Services

$adm->authenticate($username, $secret);

Note: If authentication fails, it's probably because your company endpoint is different from the default. To verify, this, call the getEndpoint() method:

echo $adm->getCompanyApi()->getEndpoint('My Company Name');
// ""

If the return value of this function is different from, you will need to set the endpoint in your client


Deauthenticate a user

Cancels authentication.


Next requests will not be authenticated


For queueing SiteCatalyst reports Wraps SiteCatalyst Report API.

$reportApi = $adm->getReportApi();

Run a Ranked Report

$response = $reportApi->queueReport(array(
    'reportSuiteID' => 'your-id',
    'date'     => date('Y-m-d'),
    'metrics'  => array(
        array('id' => 'pageviews'),
    'elements' => array(
        array('id' => 'eVar1'),


The above code will render the status of your queued report, which will look something like this:

  [status]    => ready
  [statusMsg] => Your report has been queued
  [reportID] => 123456789

Retrieve a Queued Report

Once the report ID is retrieved for the trended, ranked, or overtime report, use the Report.GetReport API call to retrieve the report

$response = $reportApi->queueReport(array(
    //... (see above)

$reportId = $response['reportID'];

do {
    $report = $reportApi->getReport($reportId);
} while ($report['status'] == 'not ready');


The above code will render the Report array, which will look something like this:

    [reportSuite] => Array (
        [id]      => your-id
        [name]    => Your Report Suite
    [period]      => "Mon. 16 July 2012",
    [elements]    => Array (
        [id]      => eVar2,
        [name]    => eVar 2
    [metrics]     => Array (
        [id]      => event2
        [name]    => Page View Event
        [type]    => number
    [type]        => trended
    [data]        => Array (
    [totals]      => Array (

Returns an array of results as described in the documentation

Calling Additional Methods

All the methods visible in the API Explorer can be called using the SuiteApi class. This is a generic class that accepts the method name and parameters, and will return the json encoded response of the result.

$adm->getSuiteApi()->post('Saint.ExportCreateJob', $parameters);

Curl Debugging

If a request returns null, call the getLastResponse method on the client in order to see the curl information and raw response:

if (!$response = $adm->getReportApi()->getReport($reportId)) {

Passing in the debug flag to the HttpClient will output the response automatically when the response does not exist, or is not in json format

$adm = new AdobeMarketingCloud\Client(
  new AdobeMarketingCloud\HttpClient\Curl(array('debug' => true))

Command Line Utility

OAuth is not yet available for production use. This functionality is still under development.

The easiest way to begin with OAuth is by using the command line utility tool (bin/adm).

To get started, copy over the configuration file:

$ cp config/profile.json.dist config/profile.json

Once this is done, run the adm command to get started

$ ./bin/amc

Calls the Adobe Marketing Cloud APIs
To get started, call

    $ amc authorize

to retrieve a token.  Some other options available are

 -h, --help      Display a help message and exit
 -v, --version   Display the current api version
 -e, --endpoint  Specify the api endpoint

See for more information

The first step will be to get an oauth token. This can be accomplished by providing the authorize command with a client id, client secret, username and password. Client IDs can be created in the Developer Connection. Once you've done this, run the authorize command to receive a token:

Token: {

You've now received your first access token. This has been saved to config/profile.json, so you don't need to worry about it. You can go ahead and start making requests!

$ adm request Company.GetReportSuites
   [report_suites] => Array
           [0] => Array
                   [rsid] => your.rsid
                   [site_title] => Your Site


The default endpoint is If you are experiencing issues, call the Company.GetEndpoint method to find out which endpoint you should be using:

$ ./bin/adm Company.GetEndpoint 'company=My Company'

In this case, the endpoint is To use this endpoint instead, set the endpoint in your profile:

$ ./bin/amc profile endpoint
default value for "endpoint" set to

Now all subsequent requests will use this endpoint. If you need to use an endpoint other than the default, you can pass this in with the -e or --endpoint options

$ ./bin/amc authorize CLIENT_ID CLIENT_SECRET USERNAME PASSWORD --endpoint ''

To Do

Better documentation and test coverage will be coming soon