Requesting reporting data

This section provides prerequisites for using OData, request limits, and instructions for using the example collection.

Prerequisites

To start using OData, you need:

  • Application that supports OData

  • OData service enabled. For this create a ticket.

  • Sinch Contact Pro user account and OData service rights given in System Configurator (SC).

Request limits

When you request data from Sinch Contact Pro reporting tables, tenant requests go through AWS API gateway and they have 30-second timeout and maximum payload size of 10 MB.

To make sure that requests are faster, there are limits how many rows are shown per page.

Table Max. number of rows/page

FactBillingData

100000

FactCallStatistics

100000

FactCemAgents

5000

FactCemContactArriveds

30000

FactCemContactContents

3000

FactCemContacts

3000

FactCemQueues

20000

FactContactAllocations

10000

FactQueueAgentMatrices

30000

DimTimes

15000

When your request has more rows than the page limit allows, use the link at the end of the result to continue to the next request. Many applications are able to continue automatically using the @odata.nextLink

Example: The FactCemContacts table has the limit of 3000/page. If you request 10000 rows (top=10000), OData service first returns 3000 rows and the link to continue to the next request: @odata.nextLink": "https://mydata.sinch.com:8433/odata/v1/FactCemContacts?$top=7000&$skiptoken=RowId-3000.

In this example, OData returns three times 3000 rows and in the last time 1000 rows.

Requesting data with Postman

We have an example collection of OData requests for Postman . It covers all the Reporting database tables.

To use the collection, do the following:

  1. Download the ODataService.postman_collection.json from GitHub and save it.

  2. Open Postman and import the ODataService.postman_collection.json.

  3. Create an environment.

    This way your user credentials and URL are not visible. And if you have several systems, it's easy to switch between them when you have created environments for them.

  4. Define URL and user credentials.

    • BASE_URL: The URL of your Sinch Contact Pro OData service

    • Userid: Your Sinch Contact Pro logon name

    • Password: Your Sinch Contact Pro password

    There are also settings that are optional:

    • ContactRecordGUID: Contact record GUID used by the request Test select one (first)- ContactRecords.

      If the given GUID is incorrect, the request doesn't return any contact record info. You can pick a GUID from the request Test top 10 – ContactRecords.

    • Agent2_UserId: You can use this user for negative tests (named as Negative - [test name]) to return the right message. This user must be a Sinch Contact Pro user with a password but doesn't need rights to use the OData service.

    • Agent2_Password: The Sinch Contact Pro password of Agent2_UserId.

Now you can start requesting data.

Tip:
  • If you want to retrieve:

    • metadata in json format, use http://[URL for OData service]/

    • metadata in xml format, use http://[URL for OData service]/$metadata

    • DimAgents content, use http://[URL for OData service]/DimAgents

  • To define how many results you want to receive, add it to your request URL, for example "[URL]/FactCemContactArriveds?$top=10"

  • If you want to post several requests at the same time, use POST for the Batch request.

Note the following about these Postman request sets:

  • Test top 10 requests return for each resource 10 results if there are 10 or more result members.

  • Test select one (first) requests return data based on a key. The key is the dimension's resource PK_xxx value and for fact resources RowId value. For data based on fact tables, the first value is set based on Sinch development environment so to get data from your environment, you need to change it. You get the right value by using one of the Test top 10 requests.

  • For some resources you may need to change the GUID or key value to get data from your environment.