Skip to main content
Skip table of contents

Automating Feeds with the TurnTo API for Emplifi Ratings & Reviews

You can use the TurnTo API for Emplifi Ratings & Reviews to transfer batch feeds, catalog feeds, or email opt-out lists.

Feeds are communicated via secure HTTPS. When your site is set up with us, you are issued a siteKey and an authKey.

  • siteKey is the public identifier for your site. It is used on your web page to display the Emplifi widget. It is also used anywhere that we need to identify that the request is from your site.

  • authKey is a private key that you will use for communicating with the Emplifi API for transferring feeds.

The siteKey and the authKey are both required whenever an API call is made to transfer a feed.

Transfers to Emplifi Ratings & Reviews via the API return the word "SUCCESS" if the transfer is successful.

Here are examples of how to send an opt-out list file or a feed through the API. Your system can create a file with the opt-out list or feed on your side and then transfer it to Emplifi Ratings & Reviews with any HTTP post transfer method. These scripts assume access to a file you created, named for this example, "email_optout.txt", "turnto_feed_tab.txt" or "cancelled_orders.txt"

Examples of transferring files via CURL

The following examples demonstrate the commands to transfer files via CURL for the specified use case.

Email opt-out list

This example shows how to send an email opt-out list via CURL to Emplifi Ratings & Reviews.

BASH
curl -F "siteKey=yoursitekey" -F "authKey=yourauthkey" \
-F "file=@email_optout.txt" https://www.turnto.com/emailFeed/postfile
Catalog feed or historical order feed

This example shows how to send a catalog feed or historical order feed tab file via CURL to Emplifi Ratings & Reviews.

BASH
curl -F "siteKey=yoursitekey" -F "authKey=yourauthkey" \
-F "feedStyle=tab-style.1" \
-F "file=@turnto_feed_tab.txt" https://www.turnto.com/feedUpload/postfile
Cancelled order feed

This example shows how to send a cancelled orders feed file via CURL to Emplifi Ratings & Reviews.

BASH
curl -F "siteKey=yoursitekey" -F "authKey=yourauthkey" \
-F "feedStyle=cancelled-order.txt" \
-F "file=@cancelled_orders.txt" https://www.turnto.com/feedUpload/postfile

Examples of transferring files via Perl

The following examples demonstrate the code to transfer files via Perl for the specified use case.

Email opt-out list

This example shows how to send an email opt-out list via Perl to Emplifi Ratings & Reviews.

PERL
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;

my $file = "email_optout.txt";
my $siteKey = "yoursitekey";
my $authKey = "yourauthkey";
my $url = "https://www.turnto.com/emailFeed/postfile";

my $ua = LWP::UserAgent->new();
my $response;

$response = $ua->post($url, Content_Type => 'form-data', Content => [ siteKey => "$siteKey", authKey => "$authKey", file => [$file]]);
print $response->decoded_content;
exit;
Catalog feed or historical order feed

This example shows how to send a catalog feed or historical order feed tab file via Perl to Emplifi Ratings & Reviews.

PERL
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;

my $file = "turnto_feed_tab.txt";
my $siteKey = "yoursitekey";
my $authKey = "yourauthkey";
my $url = "https://www.turnto.com/feedUpload/postfile";
my $feedStyle="tab-style.1";

my $ua = LWP::UserAgent->new();
my $response;

$response = $ua->post($url, Content_Type => 'form-data', Content => [ siteKey => "$siteKey", authKey => "$authKey", feedStyle => "$feedStyle", file => [$file]]);
print $response->decoded_content;
exit;
Cancelled order feed

This example shows how to send a cancelled orders feed file via Perl to Emplifi Ratings & Reviews.

PERL
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;

my $file = "cancelled_orders.txt";
my $siteKey = "yoursitekey";
my $authKey = "yourauthkey";
my $url = "https://www.turnto.com/feedUpload/postfile";
my $feedStyle="cancelled-order.txt";

my $ua = LWP::UserAgent->new();
my $response;

$response = $ua->post($url, Content_Type => 'form-data', Content => [ siteKey => "$siteKey", authKey => "$authKey", feedStyle => "$feedStyle", file => [$file]]);
print $response->decoded_content;
exit;

Examples of transferring files via PHP

The following examples demonstrate the code to transfer files via PHP for the specified use case.

Email opt-out list

This example shows how to send an email opt-out list via PHP to Emplifi Ratings & Reviews.

PHP
<?php

  $file = "email_optout.txt";
  $siteKey = "yoursitekey";
  $authKey = "yourauthkey";
  $url = "https://www.turnto.com/emailFeed/postfile";

  $fields = array('siteKey'=>$siteKey,'authKey'=>$authKey,'file'=> "@$file");

  foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  rtrim($fields_string,'&');

  $ch = curl_init($url);
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_POST,1);
  curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
  curl_setopt($ch, CURLOPT_HEADER, 0);

  $response = curl_exec($ch);
  curl_close ($ch);
  echo $response;

?>
Catalog feed or historical order feed

This example shows how to send a catalog feed or historical order feed tab file via PHP to Emplifi Ratings & Reviews.

PHP
<?php

  $file = "turnto_feed_tab.txt";
  $siteKey = "yoursitekey";
  $authKey = "yourauthkey";
  $url = "https://www.turnto.com/feedUpload/postfile";
  $feedStyle="tab-style.1";

  $fields = array('siteKey'=>$siteKey,'authKey'=>$authKey, 'feedStyle'=>$feedStyle, 'file'=> "@$file");
  foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  rtrim($fields_string,'&');

  $ch = curl_init($url);
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_POST,1);
  curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
  curl_setopt($ch, CURLOPT_HEADER, 0);

  $response = curl_exec($ch);
  curl_close ($ch);
  echo $response;

?>
Cancelled order feed

This example shows how to send a cancelled orders feed file via PHP to Emplifi Ratings & Reviews.

PHP
<?php

  $file = "cancelled_orders.txt";
  $siteKey = "yoursitekey";
  $authKey = "yourauthkey";
  $url = "https://www.turnto.com/feedUpload/postfile";
  $feedStyle="cancelled-order.txt";

  $fields = array('siteKey'=>$siteKey,'authKey'=>$authKey, 'feedStyle'=>$feedStyle, 'file'=> "@$file");
  foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
  rtrim($fields_string,'&');

  $ch = curl_init($url);
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_POST,1);
  curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
  curl_setopt($ch, CURLOPT_HEADER, 0);

  $response = curl_exec($ch);
  curl_close ($ch);
  echo $response;

?>

Available URLs and parameters

Required arguments:

  • siteKey

  • authKey

API URLs:

  • /emailFeed/postfile - used for email opt-out feeds

    • params:

      • file (filename of file containing the email opt-out list)

  • /feedUpload/postfile - used for transaction, catalog, cancelled order, and yahoo store feeds

    • params:

      • file (the filename of the file containing the feed)

      • feedStyle (feed style of file)

        • tab-style.1

        • cancelled-order.txt

        • yahoo-style.1

        • yahoo-objinfo.xml

        • google-product.xml

        • bv-product.xml (BazaarVoice)

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.