Call-log no record returned in SandBox

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
Http request is based on dateFrom and dateTo. but no record, I checked , there are call logs in sandbox from 10/11/2016 to 10/13/2016
https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log?dateFrom=2014-03-10&dateTo=2016-10-17

I can get call log record for type, phonenumber, only datefrom and dateto didn't work, returnStatus = 200 which is correct, but no record returned.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Are you obtaining a RingCentral API access_token which is scoped as the same user's records you are viewing in the Online Account Portal (https://service[.devtest].ringcentral.com)?
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

I do get access_token, and same httpRest works in API Expolorer. it worked for other parameters such as phone, view, type. 

when I put dateFrom and dateTo, it returned response code = 200, and record count is -1. and nothing returned.

Photo of Tyler Long

Tyler Long, Official Rep

  • 8,142 Points 5k badge 2x thumb
Could you please try a different date format, such as 2016-03-10T18:07:52.534Z ?

Here is a screenshot from the documentation:



Here is the link to the doc: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefExtensionCallLog.html

Let me know wether it works for you.
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Are you URI encoding the dateTo and dateFrom values?

Example:

/restapi/v1.0/account/~/extension/~/call-log?dateFrom=2016-01-01T00%3A00%3A00.800Z&dateTo=2016-05-01T00%3A00%3A00.800Z
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb
no, just simple request like this:
Dim URL As New Uri("https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log?&dateFrom=2...)        'Dim URL As New Uri("https://platform.devtest.ringcentral.com/restapi/v1.0/account/134091004/extension/134091004/call-log... = Voice&phoneNumber = 16503514555")

        Dim response As HttpWebResponse = Nothing
        Dim API_request As HttpWebRequest = DirectCast(WebRequest.Create(URL), HttpWebRequest)
        Dim str_return As String
        Dim acc_token As String = TB_Response.Lines(0)

        API_request.Method = "GET"
        API_request.Headers("Authorization") = "Bearer " & acc_token
        API_request.Accept = "application/json"

        Try
            response = DirectCast(API_request.GetResponse(), HttpWebResponse)
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Could you try URIEncoding the query param values for `dateTo` and `dateFrom` prior to executing the HTTP Request to /call-log (if the libs you're implementing to format and execute the HTTP request do not already do this for you)? Please report the result.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb
thanks. I added HtmlEncode

Dim URL As New Uri(WebUtility.HtmlEncode("https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log?&dateFrom=2...;)),

works.

Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Perfect, glad I was able to help.