Advocates


This set of API functions deals with managing advocate data. An advocate is a person who has enrolled in a campaign (aka a referrer).

Fields that are marked with [REQUIRED] are needed with the API function call. Other fields are optional.

READ - CREATE - UPDATE


GET - Obtain a Advocate Record

Fetch data on a single advocate for a website.

https://reverbapi.trackstreet.com/api/v1/advocates/<website_uuid>/<advocate_email>
https://reverbapi.trackstreet.com/api/v1/advocates/<website_uuid>/<advocate_uuid>
https://reverbapi.trackstreet.com/api/v1/advocates/<website_uuid>/<store_customer_id>

Parameter Description
website_uuid The internal universal unique ID for the website the advocate belongs to
advocate_email, advocate_uuid, or store_customer_id

One of the following identifiers must be used to obtain a advocate/advocate record.

  • advocate_email = The email address for the advocate/advocate.
  • advocate_uuid = The Reverb UUID for the advocate/advocate.
  • store_customer_id = The ID that is internal to your eCommerce/website platform for your advocate/user.
Example Call:
PHP
<?php

// The consumer key and secret can be obtained from website settings in Reverb admin app
$consumer_key = 'REVERB_API_CONSUMER_KEY';
$consumer_secret = 'REVERB_API_CONSUMER_SECRET';

$advocate_email = 'johndoe@example.com';
$website_uuid = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';

$url = 'https://reverbapi.trackstreet.com/api/v1/advocates/' . $website_uuid . '/' . $advocate_email;

// @link http://php.net/manual/en/function.curl-setopt.php
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
$response = curl_exec($curl_handle);
curl_close($curl_handle);

echo($response);

?>
        
Example Response:
{
   "response":{
      "code":200,
      "message":"OK: The request was successful. See 'data' node for response.",
      "data":{
         "advocate":{
            "uuid":"6039a519-12e0-46be-9455-9d8d00000000",
            "first_name":"Bob",
            "last_name":"Smith",
            "email":"bob.smith@domain.com",
            "store_customer_id":"2672992",
            "offers":[
               {
                  "uuid":"6039a519-e7e8-41b0-869f-9d8d00000000",
                  "campaign_uuid":"5f05fabc-a518-4a2f-aafc-772d783b3e85",
                  "destination_uuid":"532a260d-6a0c-3767-897c-c0d300000000",
                  "destination_url":"https://mydestination.com",
                  "offer_codes":[
                     {
                        "share_channel":"Email",
                        "share_code":"ndikfm"
                     },
                     {
                        "share_channel":"Facebook",
                        "share_code":"d268g2"
                     },
                     {
                        "share_channel":"Twitter",
                        "share_code":"uca8x7"
                     },
                     {
                        "share_channel":"Direct Link",
                        "share_code":"chl5z0"
                     },
                     {
                        "share_channel":"Offline Share",
                        "share_code":"51wf50"
                     },
                     {
                        "share_channel":"Other",
                        "share_code":"0efzt2"
                     },
                     {
                        "share_channel":"Coupon",
                        "share_code":"2v3abl"
                     },
                     {
                        "share_channel":"Instagram",
                        "share_code":"cg1asu"
                     },
                     {
                        "share_channel":"TikTok",
                        "share_code":"1yuo9u"
                     },
                     {
                        "share_channel":"SMS",
                        "share_code":"qeet9k"
                     }
                  ]
               }
            ]
         }
      }
   }
}
        

POST - Create a Advocate Record

This API endpoint allows you to create new advocate advocates and enroll them in a campaign.

You must provide at least one of these parameters to identify the new advocate: email, store_customer_id, or phone

https://reverbapi.trackstreet.com/api/v1/advocates

Variable Description
website_uuid [REQUIRED] The unique ID that Reverb has assigned to your website
email [REQUIRED] Advocate's email address
store_customer_id The internal customer ID used within your website for this advocate
first_name [REQUIRED] Advocate's first name
last_name [REQUIRED] Advocate's last name
payment_email Advocate's email address that they use to receive payments (example: PayPal email address)
company_name Advocate's company name
address_line_1 Advocate's address - line 1
address_line_2 Advocate's address - line 2
city Advocate's city
state Advocate's state
zip Advocate's ZIP code
phone Advocate's phone number
fax Advocate's fax number
tax_number Advocate's EIN/tax number
campaign_uuid Campaign UUID for the program that you would like to enroll this new advocate in.
referrer_email Email address for referrer advocate who referred this new advocate. You can also use referrer_advocate_uuid instead to identify referrer.
referrer_advocate_uuid The Reverb UUID for the referrer advocate record. You can also use referrer_email instead to identify referrer.
Example Call:
PHP
<?php

// The consumer key and secret can be obtained from website settings in Reverb admin app
$consumer_key = 'REVERB_API_CONSUMER_KEY';
$consumer_secret = 'REVERB_API_CONSUMER_SECRET';

$url = 'https://reverbapi.trackstreet.com/api/v1/advocates/';

$params_array = array(
    'first_name' => 'Jane',
    'last_name' => 'Doe',
    'email' => 'jane@example.com',
    'phone' => '805-123-4567',
    'tax_number' => '467382',
    'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
);

$params = json_encode($params_array);

$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
$response = curl_exec($curl_handle);
curl_close($curl_handle);

echo($response);

?>
        
Example Response:
{
    "response": {
        "code": "200",
        "message": "OK: The request was successful. See response body for additional data.",
        "data": {
            "advocate": {
                "uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
            }
        }
    }
}
        

PUT - Update a Advocate Record

Update an existing advocate for a website. You must provide the UUID value or the email address for the advocate in the URL.

https://reverbapi.trackstreet.com/api/v1/advocates/<advocate_uuid>
https://reverbapi.trackstreet.com/api/v1/advocates/<advocate_email>
https://reverbapi.trackstreet.com/api/v1/advocates/<store_customer_id>

Variable Description
website_uuid The internal universal unique ID for the website the advocate belongs to
email Advocate's email address
first_name Advocate's first name
last_name Advocate's last name
payment_email Advocate's email address that they use to receive payments (example: PayPal email address)
company_name Advocate's company name
address_line_1 Advocate's address - line 1
address_line_2 Advocate's address - line 2
city Advocate's city
state Advocate's state
zip Advocate's ZIP code
phone Advocate's phone number
fax Advocate's fax number
tax_number Advocate's EIN/tax number
store_customer_id The internal customer ID used with your eCommerce platform for this advocate advocate.
campaign_uuid Campaign internal unique ID to enroll advocate in. This in an optional value and if not provided the advocate will be enrolled in the default campaign for the website.
Example Call:
PHP
<?php

// The consumer key and secret can be obtained from website settings in Reverb admin app
$consumer_key = 'REVERB_API_CONSUMER_KEY';
$consumer_secret = 'REVERB_API_CONSUMER_SECRET';

$advocate_email = 'johndoe@example.com';

$url = 'https://reverbapi.trackstreet.com/api/v1/advocates/' . $advocate_email;

$params_array = array(
    'website_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    'email' => $advocate_email,
    'first_name' => 'John',
    'last_name' => 'Doe',
    'phone' => '805-123-4567',
    'tax_number' => '467382',
    'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
);

$params = json_encode($params_array);

$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret);
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);
$response = curl_exec($curl_handle);
curl_close($curl_handle);

echo($response);

?>
        
Example Response:
{
    "response": {
        "code": "200",
        "message": "OK: The request was successful."
    }
}