« Back to Documentation Overview

listInterestGroups – v1.1

 listInterestGroups(string apikey, string id)

Get the list of interest groups for a given list, including the label and form information

See listInterestGroupings() for replacement
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()
struct list of interest groups for the list
Returned Fields
stringnameName for the Interest groups
stringform_fieldGives the type of interest group: checkbox,radio,select
arraygroupsArray of the group names

Examples (1)

download example code

[1] xml-rpc_listInterestGroups.php

  1. <?php
  2. /**
  3. This Example shows how to retrieve the Interest Group setup for one of your
  4. lists 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->listInterestGroups($apikey, $listId);
  13. echo "SUCCESS! \n";
  14. echo "Interest Group setup -\n";
  15. echo "Name: ".$result['name']."\n";
  16. echo "Form Field: ".$result['form_field']."\n";
  17. echo "Groups:\n";
  18. foreach ($result['groups'] as $grp){
  19. echo "\t$grp\n";
  20. }
  21. } catch (XML_RPC2_FaultException $e){
  22. echo "ERROR!!!!\n";
  23. echo $e->getFaultCode()." : ".$e->getFaultString()."\n";
  24. }