Skip to main content

ReportTrafficStats

Returns traffic volume statistics across a specified number of time periods ending at a target date and time.

:::caution Established API The SOAP API is in maintenance mode. For new integrations use the REST equivalent. :::

Method Signature

DataSet ReportTrafficStats(string SessionID, DateTime TargetTime, short NumPeriods, StatisticsPeriod Period)

Parameters

ParameterTypeRequiredDescription
SessionIDstringYesActive session token from Login()
TargetTimedatetimeYesEnd point of the reporting range; the report works backwards from this time
NumPeriodsshortYesNumber of time periods to include in the report (e.g., 7 for seven days)
PeriodStatisticsPeriodYesGranularity of each period: Hour, Day, Week, or Month

Response Object — DataSet

Returns an ADO.NET DataSet with one row per time period. Access results via DataTable rows.

ColumnTypeDescription
PeriodStartdatetimeStart of this time period
PeriodEnddatetimeEnd of this time period
ParcelsInintInbound parcels received in this period
ParcelsOutintOutbound parcels sent in this period
InterchangesInintInbound interchanges in this period
InterchangesOutintOutbound interchanges in this period
BytesInlongTotal bytes received in this period
BytesOutlongTotal bytes sent in this period
<!-- Example response XML -->
<DataSet>
<Table>
<PeriodStart>2026-05-06T00:00:00</PeriodStart>
<PeriodEnd>2026-05-06T23:59:59</PeriodEnd>
<ParcelsIn>38</ParcelsIn>
<ParcelsOut>22</ParcelsOut>
<InterchangesIn>210</InterchangesIn>
<InterchangesOut>145</InterchangesOut>
<BytesIn>1048576</BytesIn>
<BytesOut>524288</BytesOut>
</Table>
<Table>
<PeriodStart>2026-05-07T00:00:00</PeriodStart>
<PeriodEnd>2026-05-07T23:59:59</PeriodEnd>
<ParcelsIn>21</ParcelsIn>
<ParcelsOut>14</ParcelsOut>
<InterchangesIn>118</InterchangesIn>
<InterchangesOut>87</InterchangesOut>
<BytesIn>614400</BytesIn>
<BytesOut>307200</BytesOut>
</Table>
</DataSet>

:::note DataSet Access Pattern The SOAP DataSet return type is an ADO.NET dataset. Iterate Tables[0].Rows to access each period row; rows are ordered from oldest to newest period. :::

ENUMs

StatisticsPeriod

ValueDescription
HourEach period represents one hour
DayEach period represents one calendar day
WeekEach period represents one week
MonthEach period represents one calendar month

Code Examples

// .NET 10 — dotnet-svcutil generated proxy
// Get daily traffic stats for the last 7 days ending now
var targetTime = DateTime.UtcNow;

var result = await client.ReportTrafficStatsAsync(
sessionID,
targetTime,
numPeriods: 7,
StatisticsPeriod.Day);

// DataSet returned — iterate rows oldest to newest
var table = result.Tables[0];
foreach (DataRow row in table.Rows)
{
Console.WriteLine($"Period: {row["PeriodStart"]:yyyy-MM-dd}");
Console.WriteLine($" Parcels In/Out: {row["ParcelsIn"]} / {row["ParcelsOut"]}");
Console.WriteLine($" Interchanges In/Out: {row["InterchangesIn"]} / {row["InterchangesOut"]}");
Console.WriteLine($" Bytes In/Out: {row["BytesIn"]:N0} / {row["BytesOut"]:N0}");
}

REST Equivalent

See Traffic StatsPOST /v2/reports/traffic-stats.