Using Search API
This document explains how to access the data of a metric workspace through API.
This document also assumes you are familiar with Moesif API Analytics suite. For an introduction, see Introduction to Event Analytics and Logging.
Overview
Search API gives you access to your chart’s data using Moesif’s Management API. You send a POST
request to the Management API with your Management API key as the Bearer token and the search definition for the data you want to extract. This returns a JSON object containing the chart data that you can display in a more customized format. The search definition uses the Elasticsearch Query DSL.
Search API allows you to build custom solutions using your data, such as custom dashboards, reports, analytics, and so on.
Applicable Metric Types
You can access Search API for any workspace that contains one of these metric types:
Use Search API
To use Search API, from the chart you want to access through the Search API, follow these steps:
- Select Embed / API from the chart header.
-
Select Search API.
Moesif generates a cURL command for your workspace criteria that you can use immediately to access the chart data. Moesif also gives you the HTTP request details so you can use HTTP clients like Postman.
- Select the Curl Command tab for the cURL command and the HTTP Details tab for the HTTP request details.
Search Definition
The search definition Moesif generates uses the Elasticsearch Query DSL. To access the search definition, see the HTTP request body from the HTTP Details tab or the generated cURL command’s -d
(or --data
) argument value.
This search definition accurately represents your desired report according to your chart’s filters and settings. You can quickly go back to your chart window, reconfigure, select Embed / API, and then select Search API to update your search. If you need help building a query for your business requirements, contact us.
The Search API sends your request to the Management API’s events search endpoint. For more information, see the Management API searchEvents
documentation.