callRecord: getPstnCalls

命名空间:microsoft.graph.callRecords

获取 PSTN 呼叫日志,作为 pstnCallLogRow 条目的集合。

注意

此 API 不会返回 Telstra 通话套餐的信息。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ✅ ✅ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) 不支持。 不支持。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 CallRecords.Read.All 不可用。

HTTP 请求

GET /communications/callRecords/getPstnCalls(fromDateTime={fromDateTime},toDateTime={toDateTime})

函数参数

在请求 URL 中,提供以下查询参数(含值)。 下表显示了可用于此函数的参数。

参数 类型 说明
fromDateTime DateTimeOffset 要查询的时间范围的开始。 UTC,含)。
时间范围以呼叫开始时间为准。
toDateTime DateTimeOffset 要查询的时间范围结束。 UTC,含)。

重要

fromDateTime 和 toDateTime 值的日期范围不能超过 90 天。

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。

响应

如果成功,此函数将在响应正文中返回响应 200 OK 代码和 pstnCallLogRow 条目的集合。

如果日期范围内的条目超过 1,000 个,正文还包含一个 @odata.nextLink 带有 URL 的 URL,用于查询下一页调用条目。 日期范围内的最后一页没有 @odata.nextLink。 有关详细信息,请参阅在 应用中分页 Microsoft Graph 数据。

示例

以下示例演示获取指定日期范围内发生的 PSTN 通话的记录集合。 响应包括 "@odata.count": 1000 枚举第一个响应中的记录数,以及 @odata.nextLink 获取前 1,000 条以外的记录。 为便于阅读,响应仅显示一条记录的集合。 假设该日期范围内有超过 1,000 个调用。

请求

以下示例显示了一个请求。

GET https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=2019-11-01,toDateTime=2019-12-01)

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 200 OK

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.callRecords.pstnCallLogRow)",
    "@odata.count": 1000,
    "value": [
        {
            "id": "9c4984c7-6c3c-427d-a30c-bd0b2eacee90",
            "callId": "1835317186_112562680@61.221.3.176",
            "userId": "db03c14b-06eb-4189-939b-7cbf3a20ba27",
            "userPrincipalName": "richard.malk@contoso.com",
            "userDisplayName": "Richard Malk",
            "startDateTime": "2019-11-01T00:00:08.2589935Z",
            "endDateTime": "2019-11-01T00:03:47.2589935Z",
            "duration": 219,
            "charge": 0.00,
            "callType": "user_in",
            "currency": "USD",
            "calleeNumber": "+1234567890",
            "usageCountryCode": "US",
            "tenantCountryCode": "US",
            "connectionCharge": 0.00,
            "callerNumber": "+0123456789",
            "destinationContext": null,
            "destinationName": "United States",
            "conferenceId": null,
            "licenseCapability": "MCOPSTNU",
            "inventoryType": "Subscriber",
            "operator": "Microsoft",
            "callDurationSource": "microsoft"
        }
    ],
    "@odata.nextLink": "https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(from=2019-11-01,to=2019-12-01)?$skip=1000"
}