Display & Submit API

This documentation explains the mechanics of display and submitting consumer store reviews, including store specific meta-data, to Bazaarvoice using the Mobile SDK.

Introduction

Use the Bazaarvoice Mobile SDKs to enable Conversations for Stores functionality, such as displaying store reviews and submitting a review and photo of a store. The API is very similar to the Conversations API for product reviews, with the addition that the BVSDK provides additional meta-info for stores, such as geo-location. Contact Bazaarvoice to set up Conversations for Stores.

📘

You will need your apiKeyConversationsStores to implement and use Conversations for Stores with Mobile SDKs.

Installation instructions

Installation with Gradle

Include the Maven Central repository and add the appropriate Bazaarvoice Mobile SDK modules to your dependencies:

dependencies {  
    Implementation 'com.bazaarvoice.bvandroidsdk:conversations:{BV_SDK_VERSION}.+'  
    implementation 'com.google.android.gms:play-services-ads:9.{YOUR_PLAY_SERVICES_VERSION}'  
    implementation 'com.android.support:recyclerview-v7:25.{YOUR_SUPPORT_LIBRARY_VERSION}'  
}

Replace the {tokens}, including brackets, with the appropriate values. Refer to the Installation guide for {BV_SDK_VERSION}.

Extending the application

Create a class that extends android.app.Application, and initialize the Mobile SDK using its builder.

You can find a full list of build options in BVSDK.java.

in the following example, YOUR_CLIENT_ID represents your client name, such as "bazaarvoice". If you are unsure about your client ID or API key values, contact Bazaarvoice Support or your implementation team.

public class MyApplication extends Application {
@Override
public void onCreate(){
    super.onCreate();
    BVSDK.builder(application, BazaarEnvironment.PRODUCTION)
      .logLevel(BVLogLevel.VERBOSE) // Optional: Set the log level. Default level is ERROR.
      .dryRunAnalytics(false)       // Optional: Set analytics to log only, not make a network request. Default is false.
      .okHttpClient(okHttpClient)   // Optional: Use you own okHttpClient instance
      .build();
	}
}

App manifest file

Add the following to your AndroidManifest.xml file.

<!-- set the name of the class for the application entry -->

<application
    android:name=".MyApplication">  
</application>

Display stores

You can fetch store and store meta-info two ways: by known store ids, or by using limit and offset parameters. Start with the BulkStoreRequest request class and use the right Builder() constructor depending on how you want to request stores from your store feed. Stores meta-info, such as product id, description, and geo-description are contained in BVStore objects.

Bulk stores request by store ID

BVConversationsClient client = new BVConversationsClient.Builder(BVSDK.getInstance()).build(); // Use one instance  
BulkStoreRequest storesRequest = new BulkStoreRequest.Builder(TEST_BULK_PRODUCT_IDS)  
  .build();

client.prepareCall(storesRequest).loadAsync(new ConversationsCallback() {  
  @Override  
  public void onSuccess(BulkStoreResponse response) {  
    //called on Main Thread  
    response.getResults(); //contains stores  
  }

  @Override  
  public void onFailure(BazaarException exception) {  
    //called on Main Thread  
    Log.d("Dev", exception.getLocalizedMessage());  
  }  
});

Bulk stores request with limit and offset

BVConversationsClient client = new BVConversationsClient.Builder(BVSDK.getInstance()).build(); // Use one instance  
BulkStoreRequest storesRequest = new BulkStoreRequest.Builder(20,0)  
  .build();

client.prepareCall(storesRequest).loadAsync(new ConversationsCallback() {  
  @Override  
  public void onSuccess(BulkStoreResponse response) {  
    //called on Main Thread  
    response.getResults(); //contains stores  
  }

  @Override  
  public void onFailure(BazaarException exception) {  
    //called on Main Thread  
    Log.d("Dev", exception.getLocalizedMessage());  
  }  
});

Display store reviews

Requesting reviews for stores is done with the StoreReviewsRequest class. Using the limit and offset paging parameters to fold in more BVReview objects as your end-user scrolls through the reviews. Adjust parameters such as filters and sorting on the StoreReviewsRequest#Builder class. An example of requesting reviews is shown below:

BVConversationsClient client = new BVConversationsClient.Builder(BVSDK.getInstance()).build(); // Use one instance  
StoreReviewsRequest reviewsRequest = new StoreReviewsRequest.Builder(TEST_PRODUCT_ID, 20, 0)  
  .addSort(ReviewOptions.Sort.Rating, SortOrder.DESC)  
  .build();  
client.prepareCall(reviewsRequest).loadAsync(new ConversationsCallback() {  
  @Override  
  public void onSuccess(StoreReviewResponse response) {  
    //called on Main Thread  
    response.getResults(); //contains reviews  
  }

  @Override  
  public void onFailure(BazaarException exception) {  
    //called on Main Thread  
    Log.d("Dev", exception.getLocalizedMessage());  
  }  
});

Submitting a review on a store

Submit a store review using the StoreReviewSubmissionRequest API. An example for how to use this API is below.

BVConversationsClient client = new BVConversationsClient.Builder(BVSDK.getInstance()).build(); // Use one instance  
StoreReviewSubmissionRequest submission = new StoreReviewSubmissionRequest.Builder(Action.Preview, productId)  
  //.fingerPrint(blackbox)  // uncomment me when using iovation SDK  
  .userNickname("mcfly")  
  .userEmail("[[email protected]](mailto:[email protected])")  
  .user("mrmcfly" + Math.random())  
  .rating(5)  
  .title("Most excellent!")  
  .reviewText("This is the greatest store that is, has been, or ever will be!")  
  .sendEmailAlertWhenCommented(true)  
  .sendEmailAlertWhenPublished(true)  
  .agreedToTermsAndConditions(true)  
  .addPhoto(localImageFile, "Awesome Photo!")  
  .build();

client.prepareCall(submission).loadAsync(new ConversationsCallback() {

@Override  
  public void onSuccess(StoreReviewSubmissionResponse response) {  
    showDialogWithMessage("Successful review submission.");  
  }

  @Override  
  public void onFailure(BazaarException exception) {  
    showDialogWithMessage(exception.getMessage());  
  }  
});