V-Spark Online Help

Using the /appstats API with cURL

This topic discusses how to retrieve application statistics information from a V‑Spark installation. For each agent, the output returns the number of calls the agent had and the overall app scores, along with any category scores that were specified using category and depth parameters.

See the Using the Agents View section of the V‑Spark Management Guide for more information about the category statistics that are returned.

If you are unfamiliar with the cURL command, see Using cURL for REST API Testing for a short introduction and an explanation of how cURL examples are displayed. See Tips for Debugging and Managing cURL Calls for suggestions about how to debug and manage cURL calls.

An example of a cURL command to retrieve application scores from the Agent ScoreCard application on September 25, 2017, which is associated with the company "DocTestCo" and organization "DocTestCo-DocTesting" on the host example.company.com is the following:

curl -s 'http://example.company.com/appstats/DocTestCo/DocTestCo-DocTesting/Agent%20Scorecard \
    ?token=01234567890123456789012345678901&daterange=20170925'      

The format of the JSON output that is returned by this call is the following:

[
  {
    "date": "20170925",
    "agents": 3,
    "001": {
       "calls": 1,
        "overall": {
          "ncalls": 1,
          "hitmiss": "1.0000",
          "coverage": "0.2890",
          "duration": "0:11:55",
          "silence": "0:03:13"
         },
         "Communication Skills": {
            "ncalls": 1,
            "hitmiss": "1.0000",
            "coverage": "0.5667",
            "duration": "0:11:55",
            "silence": "0:03:13"
          },
          "Effectiveness": {
            "ncalls": 1,
            "hitmiss": "1.0000",
            "coverage": "0.4000",
            "duration": "0:11:55",
            "silence": "0:03:13"
          },...
      },...
   }
]      

The contents of this example have been abbreviated to save space. Each matching agent is identified numerically (001 in the previous example), with each category for which scores are available listed under the call identifier.

An example of a cURL command to retrieve category scores for the Communication Skills.Client Informed category from the Agent ScoreCard application on September 25, 2017, which is associated with the company "DocTestCo" and organization "DocTestCo-DocTesting" on the host example.company.com is the following:

curl -s 'http://example.company.com/appstats/DocTestCo/DocTestCo-DocTesting/Agent%20Scorecard\
    ?token=01234567890123456789012345678901&daterange=20170925\
    &category=Communication%20Skills.Client%20Informed&depth=1'      

As mentioned earlier, requesting category information for a subcategory also returns information about its parent categories. In this example, requesting scores for Communication Skills.Client Informed automatically also returns scores for the Communication Skills category. Since a depth of "1" is specified, the call also returns the specified number of lower levels of the Client Informed category. In this case, there is only one such lower-level category: Communication Skills.Client Informed.Agent Actions.

The format of the JSON output that is returned by this call is the following:

[
    {
        "date": "20170925",
        "agents": 3,
        "001": {
            "calls": 1,
            "overall": {
                "ncalls": 1,
                "hitmiss": "1.0000",
                "coverage": "0.2890",
                "duration": "0:11:55",
                "silence": "0:03:13"
            },
            "Communication Skills": {
                "ncalls": 1,
                "hitmiss": "1.0000",
                "coverage": "0.5667",
                "duration": "0:11:55",
                "silence": "0:03:13"
            },
            "Communication Skills.Client Informed": {
                "ncalls": 1,
                "hitmiss": "1.0000",
                "coverage": "0.3333",
                "duration": "0:11:55",
                "silence": "0:03:13"
            },
            "Communication Skills.Client Informed.Agent Actions": {
                "ncalls": 1,
                "hitmiss": "1.0000",
                "coverage": "1.0000",
                "duration": "0:11:55",
                "silence": "0:03:13"
            }
        }, ...
    }
]

You can further refine the output of a call to the /appstats API by restricting the category to a lower-level one that does not contain subcategories, as in the following example:

statistics-get-info.py  HOSTTOKEN \
    /appstats/DocTestCo/DocTestCo-DocTesting/Clone%20Test%2002 \
    'daterange=20171005&category=Politeness'

This call uses the daterange parameter to limit results to those from files processed on a single date (05 Oct 2017), and only lists specific and summary (overall) information about the category, Politeness, which has no subcategories:

[
    {
        "105": {
            "Politeness": {
                "coverage": "0.5714",
                "duration": "0:05:25",
                "hitmiss": "1.0000",
                "ncalls": 19,
                "silence": "0:02:19"
            },
            "calls": 19,
            "overall": {
                "coverage": "0.3293",
                "duration": "0:05:25",
                "hitmiss": "1.0000",
                "ncalls": 19,
                "silence": "0:02:19"
            }
        },
        "agents": 1,
        "date": "20171005"
    }
]