mailbox.list
The mailbox.list command lists mailbox items.
Results can be constrained to a time period by specifying the following:
-
An absolute time period using a start and end date
-
A relative time period defined by the "last period of time" style query (last "24h", etc.)
TR50 Request
{
"cmd": {
"command": "mailbox.list",
"params": {
"thingKey": "mythingkey",
"offset": 0,
"limit": 10
}
}
}
// Absolute time period request
{
"list": {
"command": "mailbox.list",
"params": {
"thingKey": "mythingkey",
"start": "2014-01-01T00:00:00Z",
"end": "2014-01-31T23:59:59Z",
"offset": 0,
"limit": 10
}
}
}
// Relative last period of time
{
"list": {
"command": "mailbox.list",
"params": {
"thingKey": "mythingkey",
"last": "10h",
"offset": 0,
"limit": 10
}
}
}
Request Parameters
Name |
Type |
Required |
Description |
---|---|---|---|
thingKey |
String |
Yes |
The thing key for which we want the mailbox messages for. |
status |
String |
|
Used to filter the mailbox item results by the status field. |
command |
String |
|
Used to filter the mailbox item results by command name. |
service |
String |
|
The prefix of the command name, optionally used instead to filter by service. |
from |
String |
|
Used to filter by the mailbox item results by a specified sender. |
start |
String |
|
A timestamp representing the start of the absolute time period. |
end |
String |
|
A timestamp representing the end of the absolute time period. |
last |
String |
|
Relative duration. Valid time units are "ns", "us", "ms", "s", "m", "h". |
offset |
Integer |
|
The starting list offset, used for pagination. Defaults to 0 if not specified. |
limit |
Integer |
|
Limits the number of results returned. Defaults to the maximum configured size. |
TR50 Response
If the command is sent successfully a success message and the mailbox messages are returned. Otherwise, an error and error message will be returned.
{
"cmd": {
"success": true,
"params": {
"count": 42,
"result": [
{
"id": "5355308d3100465335003f5b",
"thingKey": "alam.abcde",
"thingId": "533f0ff23100461e14002575",
"from": "53552d6031004653350000c6",
"command": "method.exec",
"status": "in-flight",
"history": [
{
"status": "new",
"ts": "2014-04-21T14:51:57.218Z",
"message": "A message"
},
...
],
"params": {},
"updated": "2014-04-21T14:51:57.22Z"
},
...
]
}
}
}
Response Parameters
Name |
Type |
Description |
---|---|---|
count |
Integer |
The total number of mailbox records. |
result |
Array |
The array of mailbox records. |
Mailbox Message Result Array Object
Name |
Type |
Description |
---|---|---|
id |
String |
The message object id. |
thingKey |
String |
The thing key. |
thingId |
String |
The thing object id. |
from |
String |
|
command |
String |
The name of the command to execute. |
status |
String |
The status of the mailbox message. |
history |
Array |
The array of the status history. |
history.status |
String |
The historical status. |
history.ts |
String |
The timestamp the record was in this status. |
history.message |
String |
The message. |
params |
Object |
An object containing parameters to be used by the command. |
updated |
String |
The timestamp the message was last updated. |
duration |
Integer |
For completed items, the number of (whole) seconds it took for the mailbox item to complete. |