How to fetch data from EMS
How to fetch data from EMS2.0 ¶
Summary ¶
EMS2.0 provides REST API to fetch data, including alerts/events, incidents, etc.
Authentication ¶
EMS2.0 use API key for authentication, you need to create an API key first.
Get the API Key ¶
- Login into EMS2.0 with admin role.
- Go to
Settings->API Keys->Create API Key. - Input the
NameandDescription, then clickCreate. - Copy the
API Keyand save it for later use.
Or contact EMS admin to create API key for you.
Use the API Key ¶
The API key need be included in the request header X-API-KEY.
Example:
X-API-KEY: your_api_key_here
x-api-key and password as your actual API key. Base URL ¶
The base URL for EMS2.0 API is:
Prod: https://csgems.prod.webex.com/v2
Stage: https://csgems.stage.webex.com/v2
API Doc ¶
https://api.keephq.dev/redoc#tag/
REST API Examples ¶
Fetch Alerts ¶
Fetch alerts with CEL query, for example, fetch the latest 10 firing alerts from source splunk.
curl --location 'https://csgems.stage.webex.com/v2/alerts/query' \
--header 'X-API-KEY: {your_api_key}' \
--header 'Content-Type: application/json' \
--data '{ "cel": "source=='\''splunk'\'' && status=='\''firing'\''", "limit": 10}'