This set of API functions deals with managing offer data. When an advocate/customer is enrolled in a campaign they are shown an offer that details the rewards, incentives and terms.
READ (GET) - CREATE (POST) - UPDATE (PUT)
Fetch data on an offer that an advocate has been enrolled in.
https://reverbapi.trackstreet.com/api/v1/offers/<offer_uuid>
Variable | Description |
---|---|
offer_uuid | The internal Reverb universal unique ID for the offer record |
<?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'; // Build and make API call $offer_uuid = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; $url = 'https://reverbapi.trackstreet.com/api/v1/offers/' . $offer_uuid; // @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); ?>
{ "response": { "code": "200", "message": "OK: The request was successful. See response body for additional data.", "data": { "offer": [ { "uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "website_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "advocate_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "website_order_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "campaign_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "destination_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "enroll_source_id": "3", "short_code": "f45gs34", "number_of_offers": 1, "created": "2021-01-02 14:34:00" } ] } } }
Create an offer and enroll an advocate in the offer.
https://reverbapi.trackstreet.com/api/v1/offers
Variable | Description |
---|---|
website_uuid | REQUIRED The internal universal unique ID for the website the customer belongs to |
customer_uuid | REQUIRED The internal universal unique ID for the customer who placed the order (create customer record before calling order API function) |
order_uuid | REQUIRED Your unique tracking string or number for the order. |
campaign_uud | REQUIRED Campaign that you are enrolling customer in to. |
destination_uud | Optional destination UUID. If one is not specified, then advocate will be enrolled for featured destination. |
<?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/offers'; $params_array = array( 'website_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'customer_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'order_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'destination_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); ?>
{ "response": { "code": "200", "message": "OK: The request was successful. See response body for additional data.", "data": { "offer": { "uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", } } } }
Use this method to update data on an existing offer within Reverb.
Note: For available fields that can be passed, see POST call section.
https://reverbapi.trackstreet.com/api/v1/offers/<offer_uuid>
<?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'; // Build and make API call $offer_uuid = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; $url = 'https://reverbapi.trackstreet.com/api/v1/offers/' . $offer_uuid; $params_array = array( 'offer_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'customer_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); ?>
{ "response": { "code": "200", "message": "OK: The request was successful.", } }