« Back to Documentation Overview

listMergeVars – v1.1

 listMergeVars(string apikey, string id)

Get the list of merge tags for a given list, including their name, tag, and required setting

List Related
apikey a valid API Key for your user account. Get by calling Get by visiting your API dashboard
id the list id to connect to. Get by calling lists()
array list of merge tags for the list
Returned Fields
stringnameName of the merge field
charreqDenotes whether the field is required (Y) or not (N)
stringtagThe merge tag that's used for forms and listSubscribe() and listUpdateMember()

Examples (1)

download example code

[1] xml-rpc_listMergeVars.php

  1. <?php
  2. /**
  3. This Example shows how retrieve the setup of your Merge Variables for a list
  4. using XML-RPC.
  5. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  6. **/
  7. require_once 'XML/RPC2/Client.php';
  8. require_once 'inc/config.inc.php';
  9. try {
  10. $client = XML_RPC2_Client::create($apiUrl);
  12. $result = $client->listMergeVars($apikey, $listId);
  13. echo "SUCCESS! \n";
  14. foreach($result as $i=>$var){
  15. echo "Var #$i:\n";
  16. echo "\tTag: ". $var['tag']."\n";
  17. echo "\tName: ". $var['name']."\n";
  18. echo "\tRequired: ". $var['req']."\n";
  20. }
  21. } catch (XML_RPC2_FaultException $e){
  22. echo "ERROR!!!!\n";
  23. echo 'code: '.$e->getFaultCode()."\n";
  24. echo 'msg : '.$e->getFaultString()."\n";
  25. }
  26. echo "\n";