« Back to Documentation Overview

getAffiliateInfo – v1.1

 getAffiliateInfo(string apikey)

Retrieve your User Unique Id and your Affiliate link to display/use for Monkey Rewards. While we don't use the User Id for any API functions, it can be useful if building up URL strings for things such as the profile editor and sub/unsub links.

Section
Helper
Parameters
apikey a valid API Key for your user account. Get by calling Get by visiting your API dashboard
Returns
array containing your Affilliate Id and full link.
Returned Fields
stringuser_idYour User Unique Id.
stringurlYour Monkey Rewards link for our Affiliate program

Examples (2)

download example code

[1] mcapi_getAffiliateInfo.php

  1. <?php
  2. /**
  3. This Example shows how to Update an A/B Split Campaign via the MCAPI class.
  4. **/
  5. require_once 'inc/MCAPI.class.php';
  6. require_once 'inc/config.inc.php'; //contains apikey
  7.  
  8. $api = new MCAPI($apikey);
  9.  
  10. $retval = $api->getAffiliateInfo();
  11.  
  12. if ($api->errorCode){
  13. echo "Unable to Retrieve Affiliate Info!\n";
  14. echo "\n\tCode=".$api->errorCode;
  15. echo "\n\tMsg=".$api->errorMessage."\n";
  16. } else {
  17. echo "Your Affiliate Info:\n";
  18. echo "User Id = ".$retval['user_id']."\n";
  19. echo "Rewards link = ".$retval['url']."\n";
  20. }
  21.  

[2] xml-rpc_getAffiliateInfo.php

  1. <?php
  2. /**
  3. This Example shows how retrieve your account's Affiliate info using XML-RPC.
  4. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  5. **/
  6. require_once 'XML/RPC2/Client.php';
  7. require_once 'inc/config.inc.php';
  8. try {
  9. $client = XML_RPC2_Client::create($apiUrl);
  10.  
  11. $result = $client->getAffiliateInfo($apikey);
  12. echo "SUCCESS! \n";
  13. echo "User Id = ".$result['user_id']."\n";
  14. echo "Rewards link = ".$result['url']."\n";
  15. } catch (XML_RPC2_FaultException $e){
  16. echo "ERROR!!!!\n";
  17. echo $e->getFaultCode()." : ".$e->getFaultString()."\n";
  18. }
  19.  
  20.