PHP code example of cedricziel / amznprofilesapiphp

1. Go to this page and download the library: Download cedricziel/amznprofilesapiphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cedricziel / amznprofilesapiphp example snippets


use CedricZiel\AmznAdvertisingProfilesApi\AdvertisingProfilesClient;
use CedricZiel\AmznAdvertisingProfilesApi\Endpoint;
use CedricZiel\AmznAdvertisingProfilesApi\Header;

// You need to obtain a token via the Amazon LwA workflow
$token = '..';

$client = AdvertisingProfilesClient::createFor(
    Endpoint::Europe,
    $token,
);

// execute the endpoint of choice, see below ...
$client->listProfiles([], [Header::AmazonAdvertisingApiClientId->value => $clientId]);

use CedricZiel\AmznAdvertisingProfilesApi\AdvertisingProfilesClient;
use CedricZiel\AmznAdvertisingProfilesApi\Endpoint;
use CedricZiel\AmznAdvertisingProfilesApi\Header;
// see above how to create a client
$accessToken = '...';
$clientId = '...';
$client = AdvertisingProfilesClient::createFor(Endpoint::Europe, $accessToken);
$client->listProfiles([], [Header::AmazonAdvertisingApiClientId->value => $clientId]);

use CedricZiel\AmznAdvertisingProfilesApi\AdvertisingProfilesClient;
use CedricZiel\AmznAdvertisingProfilesApi\Endpoint;
use CedricZiel\AmznAdvertisingProfilesApi\Header;
// see above how to create a client
$accessToken = '...';
$clientId = '...';
$client = AdvertisingProfilesClient::createFor(Endpoint::Europe, $accessToken);
$client->updateProfiles([], [Header::AmazonAdvertisingApiClientId->value => $clientId]);

use CedricZiel\AmznAdvertisingProfilesApi\AdvertisingProfilesClient;
use CedricZiel\AmznAdvertisingProfilesApi\Endpoint;
use CedricZiel\AmznAdvertisingProfilesApi\Header;
// see above how to create a client
$accessToken = '...';
$clientId = '...';
$client = AdvertisingProfilesClient::createFor(Endpoint::Europe, $accessToken);
$client->getProfileById([], [Header::AmazonAdvertisingApiClientId->value => $clientId]);