PHP code example of mikemiles86 / bazaarvoice-conversations-api

1. Go to this page and download the library: Download mikemiles86/bazaarvoice-conversations-api 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/ */

    

mikemiles86 / bazaarvoice-conversations-api example snippets

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$response = $conversations_wrapper->apiRequest('data/reviews');

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

$review = $reviews_wrapper->getResultById('review_1234');

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

$configuration = [
  'arguments' => [
    'ProductId' => 'my_product',
  ],
];

$response = $reviews_wrapper->retrieveRequest($configuration);

$product_reviews = $response->getResponse('Results');

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

$reviews_submit_form = $reviews_wrapper->getSubmissionForm();

 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

$submission_data = [
  'Rating' => 5,
  'ReviewText' => 'This is my Review',
];

$reviews_wrapper->previewSubmission($submission_data);
 php
$client = new \GuzzleHttp\Client();
$api_key = '12345abcd';
$bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key);

$conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);

$reviews_wrapper = $conversations_wrapper->getContentType('Reviews');

$submission_data = [
  'Rating' => 5,
  'ReviewText' => 'This is my Review',
];

$reviews_wrapper->submitSubmission($submission_data);