PHP code example of jakiboy / apaapi

1. Go to this page and download the library: Download jakiboy/apaapi 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/ */

    

jakiboy / apaapi example snippets



/**
 * @see Use Composer, 
 * Or 

// (1) Init request builder
$builder = new Builder('CREDENTIAL_ID', 'CREDENTIAL_SECRET', 'TAG', 'LOCALE');

// (2) Get response (Search)
$data = $builder->searchOne('Sony Xperia 1 VI'); // Normalized array



/**
 * @see Use Composer, 
 * Or 

// (1) Init product
$product = new Product('B00NLZUM36', 'com', 'test-21');

// (2) Get response
$data = $product->get(); // Array



use Apaapi\ting
$rating = new Rating('B00NLZUM36', 'com', 'test-21');

// Get Response
$data = $rating->get(); // Array



use Apaapi\lib\Cart;

// Init Cart
$cart = new Cart();
$cart->setLocale('com')->setPartnerTag('test-21');

// Get Response
$data = $cart->set(['B00NLZUM36' => 3]); // String



use Apaapi\operations\SearchItems;
use Apaapi\lib\Request;
use Apaapi\lib\Response;

// (1) Set operation
$operation = new SearchItems();
$operation->setPartnerTag('TAG')->setKeywords('KEYWORDS');

// (2) Prapere request
$request = new Request('CREDENTIAL_ID', 'CREDENTIAL_SECRET');
$request->setLocale('LOCALE')->setPayload($operation);

// (3) Get response
$response = new Response($request);
$data = $response->get(); // Array



use Apaapi\operations\GetItems;
use Apaapi\lib\Request;
use Apaapi\lib\Response;

// Set operation
$operation = new GetItems();
$operation->setPartnerTag('TAG')->setItemIds(['ASIN']);

// Prapere request
$request = new Request('CREDENTIAL_ID', 'CREDENTIAL_SECRET');
$request->setLocale('LOCALE')->setPayload($operation);

// Get response
$response = new Response($request);
$data = $response->get(); // Array



use Apaapi\operations\GetItems;
use Apaapi\operations\SearchItems;
use Apaapi\operations\GetVariations;
use Apaapi\operations\GetBrowseNodes;

// (1) GetItems
$operation = new GetItems();
$operation->setPartnerTag('TAG');
$operation->setItemIds(['ASIN']); // Array

// (2) SearchItems
$operation = new SearchItems();
$operation->setPartnerTag('TAG');
$operation->setKeywords('KEYWORDS'); // String

// (3) GetVariations
$operation = new GetVariations();
$operation->setPartnerTag('TAG');
$operation->setASIN('ASIN'); // String

// (4) GetBrowseNodes
$operation = new GetBrowseNodes();
$operation->setPartnerTag('TAG');
$operation->setBrowseNodeIds(['NODE']); // Array



use Apaapi\operations\SearchItems;

// Set Operation
$operation = new SearchItems();
$operation->setPartnerTag('TAG')->setKeywords('KEYWORDS');

// Set Resources (3)
$operation->setResources(['images.primary.small', 'itemInfo.title', 'offersV2.listings.price']);