Web REST API Examples

Introduction

The Web REST API that can be used to execute queries against the collected data and to configure a new website.

The Web REST API should not be confused with the JavaScript agent API. The JavaScript agent API exposes an API that is available on monitored websites. Your website can interact with the API of our JavaScript agent in order to enrich/configure the collected data, send custom events and more.

This page provides website monitoring related Web REST API examples. Please refer to the general Web REST API documentation to learn the fundamentals about authentication, rate limiting, terminology, conventions and more. Additionally this page shows how to access to the same data via Instana's user interface (whenever possible).

Listing all supported Website Monitoring Metrics

The Instana user interface does not currently allow inspection of all possible metrics. We therefore only list the Web REST API call.

curl -H "Authorization: apiToken $API_TOKEN" \
  "https://$UNIT-$TENANT.instana.io/api/website-monitoring/catalog/metrics?pretty"

Listing all supported Website Monitoring Tags

User Interface

Available grouping and filtering tags can be seen within the website monitoring analyze area by clicking on All Filters or Group by.

Available Tags within Instana's user interface

Web REST API

curl -H "Authorization: apiToken $API_TOKEN" \
  "https://$UNIT-$TENANT.instana.io/api/website-monitoring/catalog/tags?pretty"

Activity Breakdown by Country

User Interface

The website monitoring analyze view can provide this information. To achieve this group by beacon.geo.country while optionally filtering for a specific website using beacon.website.name. Next we configure the metrics we are interested in. Within the screenshot we have selected the total number of page loads, unique users and unique sessions.

Country Activity Breakdown within Instana's user interface

Web REST API

curl -X POST \
  -H 'Content-Type: application/json' \
  -H "Authorization: apiToken $API_TOKEN" \
  "https://$UNIT-$TENANT.instana.io/api/website-monitoring/analyze/beacon-groups?pretty" \
  -d '
{
  "type": "PAGELOAD",
  "group": {
    "groupbytag": "beacon.geo.country"
  },
  "metrics": [
    {
      "metric": "uniqueUsers",
      "aggregation": "DISTINCT_COUNT"
    },
    {
      "metric": "uniqueSessions",
      "aggregation": "DISTINCT_COUNT"
    },
    {
      "metric": "pageLoads",
      "aggregation": "SUM"
    }
  ],
  "pagination": {
    "retrievalSize": 200
  },
  "order": {
    "by": "uniqueSessions",
    "direction": "DESC"
  },
  "tagFilters": [
    {
      "name": "beacon.website.name",
      "value": "Robotshop",
      "operator": "equals"
    }
  ],
  "timeFrame": {
    "windowSize": 604800000
  }
}
'