Get a list of transactions for a client.



Parameter

Description

Required

client_idOnly retrieve records for a particular clientYES
startA timestamp to start the report fromNO
endA timestamp to end the report atNO
pagePage number, for paginationNO
maxMaximum results returned per pageNO


Example


curl https://api.transmitsms.com/get-transactions.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d client_id=335553 \
  -d 'start=2012-01-01 00:00:00'


JSON Response

{
  transactions_total: 7843,
  transactions: [
      {
        id: 2423,
        description: "Message Send",
        amount: -0.173,
        balance_standing: 4.114,
        created: "2010-01-21 02:25:54",
        message_id: 28391,
        message_status: "Sent",
        message_cost: 0.173,
        message_revenue: 0.081
      }
  ],
  page: {
    count: 79,
    number: 1
  }
}

XML Response

<?xmlversion="1.0"encoding="UTF-8"?>
<response>
  <transactions_total>7843</transactions_total>
  <transactions>
    <id>2423</id>
    <description>Message Send</description>
    <amount>-0.173</amount>
    <balance_standing>4.114</balance_standing>
    <created>2010-01-21 02:25:54</created>
    <message_id>28391</message_id>
    <message_status>Sent</message_status>
    <message_cost>0.173</message_cost>
    <message_revenue>0.081</message_revenue>
  </transactions>
  <page>
    <count>79</count>
    <number>1</number>
  </page>
</response>


PHP Example


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

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

 $result = $api->getTransactions(1847,'2012-01-01 00:00:00');

 if ($result->error->code == 'SUCCESS') {
   echo "There are {$result->transactions_total} transactions for this client, 
     showing page {$result->page->number} of {$result->page->count} <hr>";

   foreach ($result->transactionsas$transaction) {
     echo "{$transaction->description} at {$transaction->created} - {$transaction->amount}<br>";
   }

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