How to call report API
  • 08 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

How to call report API

  • Dark
    Light

Article summary

Comm100 Reports

Comm100 provides robust reports which focus on the data and metrics that matter most to your chat quality, agent performance, visitor satisfaction, Chatbot performance, Ticketing & Messaging performance so that you can make informed decisions for improvement. You can login to control panel with comm100 account to check details. To learn more for reports, see this article.

Comm100 Report API

The comm100 report APIs allow you to share data seamlessly with third party systems. To learn more, check out report API reference.

Prerequisites to call report API:

1.All report API is using the same end point reportingquery/reports/query, for exmple if you're on the US ent platform(dash12.comm100.io), the full endpoint would be https://api12.comm100.io/v4/reportingquery/reports/query.
2.Call Method is POST
3.The JSON request payload is required, different report needs to use different request payload.There're two ways to get the JSON request payload:

  • 3.1. We have provided report API examples for different reports, check out report API reference to get the JSON request payload for corresponding report and adjust properly based your own need.
    image.png

  • 3.2. You can also login to Comm100 control panel, open browser Devtools(right click the mouse ->Inspect ->Network) and Navigate to report, take Live Chat chat volume as example, you follow the similar steps to get JSON request payload for other reports:
    a) Right click mouse Inspect ->Network tab.
    b) Navigate to Reporting->Live Chat ->Chat Volume ->By Time -> Display by Day and select "site“ (you can also select Campaign, Department).
    c) Filter by "query" and find name "query?siteid={your siteID}", then Payload -> Request Payload->view source. If you find multiple "query?siteid={your siteID}", mean have navigated multiple reports, you need check the request payload to find the correct one you want to use.
    d) Once click the view source, then scroll down, then you double click mouse to select whole JSON request payload and copy. If find Show more which mean request payload not displayed completely, click the Show more, double click mouse to select whole JSON request payload and copy.

image.png

image.png

image.png

Once you finish the prerequisites to call report API, you can proceed the following to call the report API

POSTMAN to call report API

  1. Log in to Postman.
  2. Go to **New > Request ** to create the reuqest.(Menu might be differect on different Postman version)
  3. Select the POST method and provide the API request URL. The following example requests a Chat Volume report API: https://api12.comm100.io/v4/reportingquery/reports/query?siteid=10100000
    Note:When using API key to call the interface, you need to bring the parameter siteId
  4. Go to the Authorization tab and choose the authentication type as Basic Auth as API Key authentication or Oauth 2.0 as Oauth authentication
  5. Go to the Headers tab, input key as "Content-Type" and value as "application/json"
  6. Go to the Body tab, select Raw -> JSON(application/json), input JSON request payload which you can get it based on Prerequisites to call report API.
  7. Click Send.
    Note:You can use "Beautify" function to format the JSON request payload.
    image.png

image.png

CURL to call report API

curl https://api12.comm100.io/v4/reportingquery/reports/query \ 
-X 'POST' \ 
-H 'Authorization: Bearer {access_token}' \ 
-H 'Content-Type: application/json' \ 
-D ''{"cubeEntities":[{"name":"Chat","fields":[{"name":"chats","calculationType":"count","valueType":"int","expression":"","fieldName":"Status","conditionExpression":"Status0","conditions":[{"name":"Status0","fieldName":"Status","operate":"equals","values":["0"]}]},{"name":"missedChats","calculationType":"count","valueType":"int","expression":"","fieldName":"Status","conditionExpression":"missedChatStatus","conditions":[{"name":"missedChatStatus","fieldName":"Status","operate":"equals","values":["2","3"]}]},{"name":"refusedChats","calculationType":"count","valueType":"int","expression":"","fieldName":"Status","conditionExpression":"refusedChatStatus","conditions":[{"name":"refusedChatStatus","fieldName":"Status","operate":"equals","values":["1"]}]},{"name":"chatRequests","calculationType":"expression","valueType":"int","expression":"chats + missedChats + refusedChats","fieldName":"","conditionExpression":"","conditions":[]},{"name":"chatAcceptanceRate","calculationType":"expression","valueType":"percent","expression":"chats / chatRequests","fieldName":"","conditionExpression":"","conditions":[]},{"name":"time","calculationType":"originalValue","valueType":"string","expression":"","fieldName":"","conditionExpression":"","conditions":[]}],"rowGroups":[{"name":"time","fieldName":"RequestedTime","isFull":true,"timeDisplayType":"day"}],"filters":[{"fieldName":"RequestedTime","matchType":"between","value":["2021/03/25","2021/04/23"]}]},{"name":"VisitsStatistics","fields":[{"name":"visits","calculationType":"sum","valueType":"int","expression":"","fieldName":"VisitCount","conditionExpression":"","conditions":[]}],"rowGroups":[{"name":"time","fieldName":"LogTime","isFull":true,"timeDisplayType":"day"}],"filters":[{"fieldName":"LogTime","matchType":"between","value":["2021/03/25","2021/04/23"]}]}],"mergeType":"column","timezone":-420}'
' 

Was this article helpful?