Is there a way to search for a phone number using the API to retrieve contact history information?
And by searching a phone number, I meant searching in my own org for a specific number. Should I use the Analytics API for this? If so, would the POST /api/v2/analytics/conversations/details/query be the best place to start?
Yep, you're on the right track. Historical information must be retrieved using analytics. Here's a request I made that returned all conversations in the interval that had a participant whose ANI contained "317":
POST /api/v2/analytics/conversations/details/query HTTP/1.1
Host: api.mypurecloud.com
Authorization: bearer mytoken
Content-Type: application/json
{
"interval": "2016-06-14/2016-06-21",
"segmentFilters": [
{
"type":"or",
"predicates": [
{
"dimension": "ani",
"value": "317"
}
]
}
]
}
You can get more information about this type of query here: https://developer.mypurecloud.com/api/rest/v2/analytics/conversation.html
When going through the AnalyticsConversationQueryResponse object, What data item represents the phone number dialed by one of our agents? The only thing I can find that might be it is the "DNIS". Is this correct?
Yes, the DNIS on the user/agent participant indicates the number dialed.