callRecord: getPstnCalls
Namespace: microsoft.graph.callRecords
Get a log of PSTN calls as a collection of pstnCallLogRow entries.
Note
This API doesn't return information for Telstra or Softbank calling plans.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Not supported. | Not supported. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | CallRecords.Read.All | Not available. |
HTTP request
GET /communications/callRecords/getPstnCalls(fromDateTime={fromDateTime},toDateTime={toDateTime})
Function parameters
In the request URL, provide the following query parameters with values. The following table shows the parameters that can be used with this function.
Parameter | Type | Description |
---|---|---|
fromDateTime | DateTimeOffset | Start of time range to query. UTC, inclusive. Time range is based on the call start time. |
toDateTime | DateTimeOffset | End of time range to query. UTC, inclusive. |
Important
The fromDateTime and toDateTime values cannot be more than a date range of 90 days.
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Response
If successful, this function returns a 200 OK
response code and a collection of pstnCallLogRow entries in the response body.
If there are more than 1,000 entries in the date range, the body also includes an @odata.nextLink
with a URL to query the next page of call entries. The last page in the date range doesn't have @odata.nextLink
. For more information, see paging Microsoft Graph data in your app.
Example
The following example shows getting a collection of records for PSTN calls that occurred in the specified date range. The response includes "@odata.count": 1000
to enumerate the number of records in this first response, and @odata.nextLink
to get records beyond the first 1,000. For readability, the response shows only a collection of one record. Assume there are more than 1,000 calls in that date range.
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/communications/callRecords/getPstnCalls(fromDateTime=2019-11-01,toDateTime=2019-12-01)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
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"
}