ExtraHop REST API on SwaggerHub?

api
metrics

#1

Could the ExtraHop REST API please be made available on SwaggerHub?

/api/v1/explore is nice to read through, and https://docs.extrahop.com/current/rest-api-guide/ helps fill in some gaps…

Figuring out what “metric_category” is available for “object_type”:“device_group” required looking into the Metric Catalog via the Web UI. E.g. “net” for “pkts_in”. Is there a way to get this info without using the Web UI?


#2

Hi Tim,

Are there specific features from SwaggerHub that you’d like to see in ExtraHop’s API explorer?

The metric category information is currently only available via the web UI; built-in metrics have the same IDs across all customer appliances, but custom metrics vary based on appliance so the list of valid values isn’t static.

Thanks,
Ted


#3

I encountered some issue where the Dashboards and Metrics page would constantly refresh while logged in with my account with full permissions. The firmware was recently updated to the latest version on one appliance so that I could rewrite and test a script that fetches metrics.

I was able to view the Metric catalog after logging in as root*. It would’ve been easier if I could just get a dump of metric_category values without going through the Web UI.

It would be nice if you could open the ExtraHop REST API on SwaggerHub and generate some client SDK’s:
https://app.swaggerhub.com/help/apis/generating-code/client-sdk


#4

Thanks for the feedback on the metric catalog; we have an open issue exploring how to surface that data via REST, which would make bulk export much easier. The constant refreshes sound like a bug; did you contact support about that?

We don’t recommend using code generation to produce client libraries; Carlos Barragan did a good writeup on the problems that causes, which I’ve excerpted below:

At first glance there is nothing wrong with code generation. It is actually seen as a productivity boost. Here is the thing though: When consuming a REST API you want to be as tolerant as possible. This means, you should only consider, or read, the elements in the payload that you need and ignore anything else you don’t. It also means, that you should not make any assumption regarding the structure of the payload. This is known as the Tolerant Reader Pattern . If you implement the tolerant reader pattern correctly, modifying the payload – i.e adding a new element – should not break the client code.
http://blog.novatec-gmbh.de/the-problems-with-swagger/

ExtraHop strives to maintain API compatibility across firmware versions, but generated client libraries are susceptible to compat breaks due to non-breaking API changes, such as adding an enum value. We do not support code generated from our API specification.

That said, you could generate client libraries using swagger-codegen in conjunction with the file that powers the API Explorer. The URL to that file is located in the textbox at the top of the API Explorer.


#5

Thanks Ted.

I haven’t raised a support ticket for the refresh issue. It seems to work in Firefox with the system user. I’ll see if other users want to raise it as an issue. Other users configure the device groups etc and I have a script fetching metrics and pushing the data into another system. At the moment I’m just hand coding the client for ETL based on documentation and experience with the previous API (e.g. convert the from and until values into a UTC date/time).

I should crack open some books by Mike Amundsen for Hypermedia APIs. :slight_smile: