can not get Call log on for all users and extensions--- production enviroment

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am working in Production environment,  I login with username = maincompanyNumber,  
request is: https://platform.ringcentral.com/restapi/v1.0/account/502681018/call-log?
but can not get all call logs for all users under? Am I doing something wrong?

Thanks.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,978 Points 5k badge 2x thumb
Could you please post the code here?

By default, this endpoint only returns call logs in the past 24 hours. You need to specify dateTo and dateFrom parameters in order to get call logs for a longer period.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

this is request , I tried to get for one week, I can see all call logs from service.ringcentral.com.  but in my code, it didn't work.

https://platform.ringcentral.com/restapi/v1.0/account/502681018/extension/~/call-log?type=Voice&dateFrom=2016-10-21T00:00:00.000Z&dateTo=2016-10-28T00:00:00.000Z

(Edited)
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,190 Points 5k badge 2x thumb
Instead of https://platform.ringcentral.com/restapi/v1.0/account/502681018/extension/~/call-log?type=Voice&dateFrom=2016-10-21T00:00:00.000Z&dateTo=2016-10-28T00:00:00.000Z

Please try https://platform.ringcentral.com/restapi/v1.0/account/502681018/call-log?type=Voice&dateFrom=2016-10-21T00:00:00.000Z&dateTo=2016-10-28T00:00:00.000Z

Don't forget to post the HTTP response status and body here. 

And by the way, you need to do URL encoding because dateFrom and dateTo contain special characters.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

I did use encode in request and removed extension/~,   still get one call log I made on web page today. it should return records for my date range.

(Edited)
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

1) in my code, I tried simple request: https://platform.ringcentral.com/restapi/v1.0/account/~/call-log?

and Encode it. it returned status = 200(OK), but response.length = -1, still could not get it work.

2) I tested call log API on  ringCentral Advanced Rest Client, same Request and same Access Token, worked fine. returned all records.  don't know why it didn't work in my VB code.

-------------------------------------------------------------------------------code------------------

API_request.Method = "GET"

API_request.Headers("Authorization") = "Bearer " & G_Access_Token

API_request.Accept = "application/json"

Try

response = DirectCast(API_request.GetResponse(), HttpWebResponse)

If (response.ContentLength > 0) Then

Dim _Stream As New System.IO.StreamReader(response.GetResponseStream())

str_return = _Stream.ReadToEnd()

_Stream.Close()

Else

Exit Sub

End If

Catch ex As Exception

MsgBox(response.StatusCode & ":" & response.StatusDescription)

response = Nothing

Finally

----------------------------------- end of code------------------------------------

(Edited)
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,190 Points 5k badge 2x thumb
We have a C# SDK here: https://github.com/ringcentral/ringcentral-csharp I think it also works for VB. Could you please try it? Here is the doc: http://ringcentral-csharp.readthedocs.io/en/latest/

I am confused because you said both "still get one call log" and "response.length = -1".

You also said "one call log I made on web page today". I think the server are returning you records for the last 24 hours only. Most likely the dateFrom parameter didn't take effect. In your sample code, I don't see how you encode and specify that parameter. Could you please send the sample project(remove your credentials) to tyler.liu@ringcentral.com ? I would like to have a try.
Photo of Yanmei

Yanmei

  • 396 Points 250 badge 2x thumb

thanks Tyler,

I tried again today with https://platform.ringcentral.com, works. and response.contentlength = -1 because:   If the Content-Length header is not set in the response, ContentLength is set to the value -1, I don't have to care about contenlength. thanks for helping. problem resolved