Using Search API
This document explains how to access the data of a User and Company analytics workspace through API from Moesif Web Portal.
This document also assumes you are familiar with Moesif user and company analytics suite. For an introduction, see Introduction to User and Company` Behavior.
You can access analytics data in three different ways from Moesif Web Portal:
- Search API: enables you to consume your usage data using API within your applications to drive custom workflows.
- Bulk Export: enables you to directly export your raw User and Company Lookup data to a data warehouse or other system.
You can also download chart data for User and Company Composition analysis.
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.
- 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.