callRecord: getSmsLog

Namespace: microsoft.graph.callRecords

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Get the log of a sent/received SMS as a collection of smsLogRow entries.

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/getSmsLog(fromDateTime={fromDateTime},toDateTime={toDateTime})

Function parameters

In the request URL, provide the following query parameters with values.

Parameter Type Description
fromDateTime DateTimeOffset Start of time range to query. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Required.
toDateTime DateTimeOffset End of time range to query. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z. Required.

Important

The fromDateTime and toDateTime values can't be more than a date range of 90 days.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this function returns a 200 OK response code and a collection of microsoft.graph.callRecords.smsLogRow entries in the response body.

If the function returns more than 1,000 entries for the specified date range, the body also includes an @odata.nextLink with a URL to query the next page of entries. The last page in the date range doesn't have an @odata.nextLink. For more information, see paging Microsoft Graph data in your app.

Example

The following example shows how to get the log of sent/received SMS that occurred in the specified date range. The response includes "@odata.count": 1000 to enumerate the number of records in this first response, and an @odata.nextLink to get records beyond the first 1,000. For readability, the response object contains only a collection of one record.

Request

The following example shows a request.

GET https://graph.microsoft.com/beta/communications/callRecords/getSmsLog(fromDateTime=2022-11-01,toDateTime=2022-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
Content-Type: application/json

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.callRecords.smsLogRow)",
    "@odata.count": 1000,
    "@odata.nextLink": "https://graph.microsoft.com/beta/communications/callRecords/getSmsLog(fromDateTime=2022-11-01,toDateTime=2022-12-01)?$skip=1000",
    "value": [
        {
            "smsId": "ef36b3e8-9922-4763-90e2-f4345c04a5d6",
            "userId": "19b900af-fe99-48d6-a9a4-b79c995afc33",
            "userPrincipalName": "ruwini.perera@contoso.com",
            "userDisplayName": "Ruwini Perera",
            "userCountryCode": "US",
            "tenantCountryCode": "US",
            "sourceNumber": "+12818602122",
            "destinationNumber": "+12673173004",
            "sentDateTime": "2022-10-06T11:15:48.6113555Z",
            "callCharge": 0.00,
            "currency": "USD",
            "smsType": "sms_in",
            "destinationContext": "Domestic",
            "destinationName": "United States",
            "otherPartyCountryCode": "US",
            "licenseCapability": "MCOSMS1",
            "smsUnits": 1,
            "administrativeUnitInfos": [
               {
                  "id": "639b616c-f164-4a6f-a933-24936b8eb210"
               },
               {
                  "id": "cc6ea167-4e92-4c2d-9391-85791e978006"
               }
            ]            
        }
    ]
}