Run Analytics Reports to Evaluate Trends and Measure Effectiveness

You can run reports using the Connect REST API to analyze information about the activities and content on your Oracle B2C Service site. Different types of users can run reports for various reasons, for example:

  • Site administrators can measure the success with the knowledge base and monitor the end user activity on the Oracle B2C Service site
  • Managers can view all the open incidents assigned to their direct reports
  • Supervisors can measure the effectiveness of the agents
  • Business analysts can get an insight into the volume of incidents and determine the usage of the knowledge base in closing the incidents

Let's look at an example to understand this better.

Peter Youngston works as a senior customer support representative responsible for running reports on the incidents in his organization. Peter analyzes the reports to determine the status of the incidents and prioritizes the incidents that his team should work on.

You can use analyticsReportResults REST resource for running reports in the Connect REST API. Use the POST method with the following syntax to run analytics reports:

https://your_site_interface/services/rest/connect/version/analyticsReportResults

You can include the ID or the LookupName of the report you want to run and use filters in the request body in JavaScript Object Notation (JSON) format.

Include the ID of the report you want to run and any filters (such as pagination) in the request body in JavaScript Object Notation (JSON) format.

Note:

  • The profile corresponding to the account used by the API must have the proper permissions to run the analytics reports.
  • Custom scripts don't run as part of running reports in the Connect REST API.
  • The Connect REST API does not support running analytics reports with computed fields for CCOM v1.3 and v1.4. As a workaround, you can create a copy of the report excluding the computed fields and run the report using the Connect REST API.

This use case discusses these scenarios:

Run a Report Using ID

Suppose you want to run a particular report based on the report ID, you can run the report as follows:

  1. Construct the request URL for the Create an analytics report result operation
  2. Provide the report ID in the request body
  3. Run the request using the POST HTTP method to run the report

Example URL

Here's the complete URL with the POST HTTP method.

POST
https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults

Example Request Body

{
"id": 27
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Run report' -d '{ "id": 27 }'

Example Response

The analytics runs with ID number 27 and returns the following response:

{
    "count": 1,
    "name": "Last Updated by Status",
    columnNames": [
        "Status",
        "Incidents",
        "Average Time Since Last Response"
    ],
    rows": [
        [
        "Unresolved",
        "46",
        null
        ]
    ],
    "links": [
        {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults"
        },
        {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults"
        },
        {
        "rel": "describedby",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/analyticsReportResults",
        "mediaType": "application/schema+json"
        }
    ]
}

Run a Report Using LookupName

Suppose you want to run a particular report based on the LookupName, you can run the report as follows:

  1. Construct the request URL for the Create an analytics report result operation
  2. Provide the LookupName in the request body
  3. Run the request using the POST HTTP method to run the report

Example URL

Here's the complete URL with the POST HTTP method.

POST
https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults

Example Request Body

{
"lookupName": "Last Updated by Status"
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Run report' -d '{ "lookupName": "Last Updated by Status" }'

Example Response

This runs the same report as in Run a Report Using ID.

Paginate a Report

Suppose you want to limit the number of results returned to avoid any possible timeouts or to avoid performance issues, you can use pagination and run the report as follows:

  1. Construct the request URL for the Create an analytics report result operation
  2. Provide the id and limit values in the request body
  3. Run the request using the POST HTTP method to run the report

Example URL

Here's the complete URL with the POST HTTP method.

POST
https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults

Example Request Body

{
"id":124,
"limit":25
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Run report' -d '{ "id": 124, "limit": 25 }'

Example Response

This returns the first 25 rows of the report. For more information, see Paginating.

Filter a Report

Suppose you want to extract a specific set of data and filter the results returned from the report, you can run the report by passing in the filters as follows:

  1. Construct the request URL for the Create an analytics report result operation
  2. Provide the filter values in the request body
  3. Run the request using the POST HTTP method to run the report

Example URL

Here's the complete URL with the POST HTTP method.

POST
https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults

Example Request Body

{
"id": 124,
"filters": [{
    "name": "Name",
    "values": "Chapman"
    }]
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Run report' -d '{ "id": 124, "filters": [{"name": "Name", "values": "Chapman" }] }'}'

Example Response

Here's an example of the response body in JSON format, which returns the contacts whose names include Chapman:

{
    "count": 2,
    "name": "Contacts",
    "columnNames": [
        "Last Name",
        "First Name",
        "Email",
        "Office Phone",
        "Disabled",
        "# Incidents"
    ],
    "rows": [
    [
        "Chapman",
        "Frederick",
        "frederick.chapman@example.com",
        null,
        "No",
        "0"
        ],
    [
        "Chapman",
        "Kathleen",
        "kathleen.chapman@example.com",
        null,
        "No",
        "1"
        ]
    ],
    "links": [
    {
        "rel": "self",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults"
        },
    {
        "rel": "canonical",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults"
        },
    {
        "rel": "describedby",
        "href": "https://mysite.example.com/services/rest/connect/v1.4/metadata-catalog/analyticsReportResults",
        "mediaType": "application/schema+json"
        }
    ]
}

Display UTC Time in a Report

Suppose you want to display the times in the reports in Universal Time Coordinated (UTC) format, you can run the report as follows:

  1. Construct the request URL for the Create an analytics report result operation
  2. Provide the LookupName in the request body
  3. Provide the OSvC-CREST-Time-UTC header with a value of true or yes. By default, the value is false, and the times are displayed in the time zone of the Oracle B2C Service server
  4. Run the request using the POST HTTP method to run the report

Note:

The value of OSvC-CREST-Time-UTC isn't case sensitive.

Example URL

Here's the complete URL with the POST HTTP method.

POST
https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults

Example Request Body

{
"lookupName": "SLA Milestones By Incident"
}

cURL Command

curl -X POST https://mysite.example.com/services/rest/connect/v1.4/analyticsReportResults -H 'Authorization: Basic YWRtaW46' -H 'Content-Type: application/json' -H 'OSvC-CREST-Application-Context: Run report' -H 'OSvC-CREST-Time-UTC: true' -d '{ "lookupName": "SLA Milestones By Incident" }'

Example Response

Here's an example of the response body in JSON format, which returns the times in UTC format:

{
  "count": 7,
  "name": "SLA Milestones By Incident",
  "columnNames": [
    "milestone_instances.i_id",
    "Milestone Name",
    "Resolution Due"
  ],
  "rows": [
    [
      "33",
      "Resolution Due",
      "2015-09-15T23:00:00.000Z"
    ],
    [
      "34",
      "Resolution Due",
      "2015-12-23T18:03:00.000Z"
    ],
    [
      "35",
      "Resolution Due",
      "2016-06-09T23:00:00.000Z"
    ],

...