Instana REST API examples

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

Introduction

You must not confuse the Instana REST API with the JavaScript agent API. The JavaScript agent API displays an API that is available on monitored websites. Your website can interact with the API of the JavaScript agent to enrich or configure the collected data, send custom events, and so on. For more information, see the general Instana 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 by using Instana's user interface (whenever possible).

Listing all supported website Monitoring Metrics

Currently, the Instana user interface does not currently allow inspection of all possible metrics. Only the Instana REST API call is available to list all website monitoring metrics.

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

Listing all supported website Monitoring Tags

The following tags support website monitoring:

User Interface

You can see the available grouping and filtering tags within the website monitoring analyze area when you click All Filters or Group by.

Available Tags within Instana's user interface

Instana 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 that uses beacon.website.name. Next, configure the metrics that you are interested in. Within the screen capture you selected, you can see the total number of page loads, unique users, and unique sessions.

Country Activity Breakdown within Instana's user interface

Instana 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
  }
}
'

Custom Geo IP Mappings

Custom geo IP mappings can be added via the Instana REST API or the user interface. Refer to the Custom Geographic Details Configuration for examples.