Get information about a list and its members.


Parameter

Description

Required

list_idList IDYES
membersWhich types of members to return.
Possible values:
active - only get active members (default)
inactive - only get inactive members
all - get active and inactive members
none - do not get any members, just metadata
NO
pagePage number, for paginationNO
maxMaximum results returned per pageNO


Example: Get inactive list members


curl https://api.transmitsms.com/get-list.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d list_id=30 \
  -d members=inactive


 Possible values of the members.status field are currently: active, deleted and opt-out.


JSON Response

{    
  page: {
    count: 26,
    number: 1
  },
  id: 34565667,
  name: "Survey Respondents",
  created: "2012-12-30 08:56:43",
  members_total: 2544,
  members_active: 2306,
  fields: {
    field_1: "Birthday",
    field_2: "Town"
  },
  members: [
    {
      first_name: "Charles",
      last_name: "Gordon",
      msisdn: "61491570156",
      created_at: "2013-05-23 01:22:12",
      status: "deleted"
    },
    {
      first_name: "Alex",
      last_name: "Fergle",
      msisdn: "61491570157",
      created_at: "2013-01-23 05:22:12",
      status: "active"
    }
  ]
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <page>
    <count>26</count>
    <number>1</number>
  </page>
  <id>34565667</id>
  <name>Survey Respondents</name>
  <created>2012-12-30 08:56:43</created>
  <members_total>2544</members_total>
  <members_active>2306</members_active>
  <fields>
    <field_1>Birthday</field_1>
    <field_2>Town</field_2>
  </fields>
  <members>
    <first_name>Charles</first_name>
    <last_name>Gordon</last_name>
    <msisdn>61491570156</msisdn>
    <created_at>2013-05-23 01:22:12</created_at>
    <status>deleted</status>
  </members>
  <members>
    <first_name>Alex</first_name>
    <last_name>Fergle</last_name>
    <msisdn>61491570157</msisdn>
    <created_at>2013-01-23 05:22:12</created_at>
    <status>active</status>
  </members>
</response>


PHP Examples


<?php
  include '../../APIClient2.php';

  $api = new transmitsmsAPI('API_KEY', 'API_SECRET');
  $offset = 0;
  $limit = 10;

  $result = $api->getList(6191, $offset, $limit);

  if ($result->error->code == 'SUCCESS') {
    echo "List has {$result->members_total} members, 
      showing page {$result->page->number} of {$result->page->count} <hr>";

    foreach ($result->membersas$member) {
      echo "{$member->first_name}{$member->last_name} - {$member->status} <br>";
    }

  } else {
    echo "Error: {$result->error->description}";
  }