andygunther | 2016-09-29 22:33:54 UTC | #1
I just installed the latest .Net package, and am trying to get Call History from the ConversationsApi.
I have a valid access token, and this block of code:
private void btnGetConversationsClick(object sender, EventArgs e) { ConversationsApi oConvoApi = new ConversationsApi(); oConvoApi.Configuration.AccessToken = msToken; int pageSize = 25; int pageNumber = 1; string interval = dtpStart.Value.ToString("yyyy-MM-ddTHH:mm:ss") + "/" + dtpEnd.Value.ToString("yyyy-MM-ddTHH:mm:ss");
ININ.PureCloudApi.Model.CallConversationEntityListing results = oConvoApi.GetCallsHistory(pageSize, pageNumber, interval);
foreach (ININ.PureCloudApi.Model.CallConversation oCall in results.Entities) {
} }
I use the system daily, so I know I have calls available - yet the results are always empty. Any ideas? Has anyone used this in the .Net library yet?
andygunther | 2016-10-02 19:50:13 UTC | #2
I get the same empty response when I just send the GET to the REST API (/api/v2/conversations/calls/history) also. So, perhaps I'm not using the method correctly, or I'm expecting it to do something it doesn't?
Ultimately, I want to fetch a list of ALL calls in or out of the system in the given interval. Is this the right method?
KevinGlinski | 2016-10-03 12:19:31 UTC | #3
That call is only to get the calls for the authenticated user, if you want all calls in the system you need POST /api/v2/analytics/conversations/details/query
andygunther | 2016-10-03 15:56:34 UTC | #4
Thanks Kevin, that helps. However, there may be something wrong in the .Net version of the API.
The highlighted lines below both throw "Object reference not set to an instance of an object." exceptions...
ConversationsApi oConvoApi = new ConversationsApi(); oConvoApi.Configuration.AccessToken = m_sToken;
string interval = dtpStart.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + "/" + dtpEnd.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
ININ.PureCloudApi.Model.ConversationQuery body = new ININ.PureCloudApi.Model.ConversationQuery();
body.Interval = interval;
body.Paging.PageNumber = 1; body.Paging.PageSize = 100;
ININ.PureCloudApi.Model.AnalyticsConversationQueryResponse results = oConvoApi.PostConversationsDetailsQuery(body);
foreach (ININ.PureCloudApi.Model.AnalyticsConversation oCall in results.Conversations) {
}
andygunther | 2016-10-03 15:58:08 UTC | #5
Nevermind, I see you have to instantiate the PagingSpec.
system | 2017-08-28 19:27:39 UTC | #7
This post was migrated from the old Developer Forum.
ref: 454