This API can be used to fetch a list of message detail records (MDRs) based on a filter criteria.
GET
https://api.plivo.com/v1/Account/{auth_id}/Message/
subaccount string | Use this argument to filter for
|
message_direction string |
Use this argument to filter the results by message direction. The valid inputs are inbound and outbound. |
message_time |
Forms of this parameter can be used to filter outbound/inbound messages based on the time the message was initiated/received. The timestamps are expected to in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format, and are considered to be in UTC timezone. The filter can be used in the following five forms:
|
message_state string |
Use this argument to filter by the current status of a message. This argument can be set to one of following states : queued, sent, failed, delivered, undelivered, received or rejected. |
message_type string |
Use this argument to filter results by the type of message - sms or mms. |
error_code string |
Use this argument to filter results by a standard Plivo error code. Read more about Plivo SMS error codes here. |
limit integer |
Used to display the number of results per page. The maximum number of results that can be fetched is 20. Defaults to 20. |
offset integer |
Denotes the number of value items by which the results should be offset. Defaults to 0. Read more about offset based pagination here. |
This API returns the list of Message Detail Records matching the filters specified in the request.
The API response also contains a meta
field with the following fields:
limit
: This the size of the page returned in the response.offset
: The offset for the page returned in the response.total_count
: The total number of records that match the specified filters.next
: The URL that points to the next page of results.previous
: The URL that points to the previous page of results.HTTP Status Code: 200
{
"api_id": "88415194-6df0-11e6-b608-06a72a185e87",
"meta": {
"limit": 2,
"next": "/v1/Account/{auth_id}/Message/?limit=20&error_code=200&offset=20",
"offset": 0,
"previous": null,
"total_count": 22
},
"objects": [
{
"error_code": "200",
"from_number": "18552828641",
"message_direction": "outbound",
"message_state": "failed",
"message_time": "2016-08-17 21:26:44+05:30",
"message_type": "sms",
"message_uuid": "85ce8068-6fab-4f0a-9dc7-d6c852cdde91",
"resource_uri": "/v1/Account/{auth_id}/Message/85ce8068-6fab-4f0a-9dc7-d6c852cdde91/",
"to_number": "19352326448",
"total_amount": "0.00000",
"total_rate": "0.00350",
"units": 1
},
{
"error_code": "200",
"from_number": "18552828641",
"message_direction": "outbound",
"message_state": "failed",
"message_time": "2016-08-17 21:22:36+05:30",
"message_type": "sms",
"message_uuid": "2a340179-e8a9-4b1d-ae2c-9f346e7b6d7d",
"resource_uri": "/v1/Account/{auth_id}/Message/2a340179-e8a9-4b1d-ae2c-9f346e7b6d7d/",
"to_number": "19352326448",
"total_amount": "0.00000",
"total_rate": "0.00350",
"units": 1
}
]
}
1
2
3
4
5
6
7
8
9
10
11
import plivo
client = plivo.RestClient("auth_id","auth_token")
response = client.messages.list(
limit=5,
offset=0,
subaccount='subaccount_auth_id',
)
print(response)
#prints only the message_uuid
print(response.message_uuid)
1
2
3
4
5
6
7
8
9
10
require "plivo"
include Plivo
api = RestClient.new("auth_id", "auth_token")
response = api.messages.list(
limit: 5,
offset: 0,
subaccount: "subaccount_auth_id",
)
puts response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var plivo = require('plivo');
(function main() {
'use strict';
var client = new plivo.Client("auth_id", "auth_token");
client.messages.list(
{
limit: 5,
offset: 0,
subaccount:"subaccount_auth_id",
}
).then(function (response) {
console.log(response);
//Prints only the message_uuid
console.log(response.messageUuid);
},);
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
require 'vendor/autoload.php';
use Plivo\RestClient;
$client = new RestClient("auth_id", "auth_token");
$response = $client->messages->list(
[
'limit' => 5,
'offset' => 0,
'subaccount' =>'subaccount_auth_id'
]
);
print_r($response);
// Prints only the message_uuid
print_r($response->getmessageUuid(0));
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.message.Message;
import com.plivo.api.models.base.ListResponse;
class GetAllMessageList
{
public static void main(String [] args)
{
Plivo.init("auth_id","auth_token");
try
{
ListResponse<Message> response = Message.lister()
.subaccount("subaccount_auth_id")
.limit(5)
.offset(0)
.list();
System.out.println(response);
// Prints only the message_uuid
System.out.println(response.getMessageUuid());
}
catch (PlivoRestException | IOException e)
{
e.printStackTrace();
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Collections.Generic;
using Plivo;
namespace PlivoExamples
{
internal class Program
{
public static void Main(string[] args)
{
var api = new PlivoApi("auth_id", "auth_token");
var response = api.Message.List(
limit:10,
offset:0,
subaccount:"subaccount_auth_id"
);
Console.WriteLine(response);
// Prints the message_uuid
Console.WriteLine(response.MessageUuid[0]);
}
}
}
1
2
curl -i --user auth_id_ID:auth_token \
https://api.plivo.com/v1/Account/{auth_id}/Message/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main
import "fmt"
import "github.com/plivo/plivo-go"
func main() {
client, err := plivo.NewClient("auth_id", "auth_token", &plivo.ClientOptions{})
if err != nil {
panic(err)
}
response, err := client.Messages.List(
plivo.MessageListParams{
Limit: 5,
Offset: 0,
},
)
if err != nil {
panic(err)
}
fmt.Printf("Response: %#v\n", response)
// Prints only the message_uuid
fmt.Printf("Response: %#v\n", response.MessageUUID)
}