1

trying to get receive informations via the Instana REST API. Looks like that:

https://[URL]/api/application-monitoring/metrics/applications?'Content-Type: application/json' -d '{"timeFrame": {"windowSize": [SIZE], "to": [SIZE]}, "metrics": [{"metric": "calls", "aggregation": "SUM"}, {"metric": "errors", "aggregation": "MEAN"}, {"metric": "latency", "aggregation": "MEAN"}, {"metric": "latency", "aggregation": "MIN"}, {"metric": "latency", "aggregation": "MAX"}], "nameFilter":"[NAME]"}'

Getting back that error:

{
  "code": 405,
  "message": "HTTP 405 Method Not Allowed"
}

The matching Curl script (which I can't use) looks like that and works:

curl -H 'Authorization: apiToken <APITOKEN>' -H 'Content-Type: application/json' -d '{"timeFrame": {"windowSize": [SIZE], "to": [SIZE]}, "metrics": [{"metric": "calls", "aggregation": "SUM"}, {"metric": "errors", "aggregation": "MEAN"}, {"metric": "latency", "aggregation": "MEAN"}, {"metric": "latency", "aggregation": "MIN"}, {"metric": "latency", "aggregation": "MAX"}], "nameFilter":[NAME]}' [URL]

Any idea?

1 Answers1

3

That endpoint requires a POST, it appears you are using GET. Hence method not allowed.

SteveWW
  • 51
  • 4
  • 1
    I thought "POST" is supposed to be used when writing something into a field or anything? – Daniel Lozynski Oct 29 '19 at 08:34
  • 2
    The documentation clearly states POST https://instana.github.io/openapi/#operation/getApplicationMetrics Think of it this way, you POST a query object to get the results you want. If it were done via GET it would need a lot of query params and be a bit messy. – SteveWW Oct 30 '19 at 09:32