We are working with Prometheus HTTP API, and we're sending GET requests to the following endpoint:
/api/v1/query
At the beginning things worked as expected, but recently when our queries got bigger, request-URI became too large.
Docs says that it is possible to send POST request to the same endpoint, and pass the query parameter directly in the request body, instead of passing a query param as part of the URL..
This should solve our problem, but I couldn't find any example or guidelines explaining how to do it.
URL query length is limited, so we are looking for a way to send the query as part of the body :
End-point : http://server:8082/api/v1/query
Body :
{
"query": "count(count(node_cpu_seconds_total{instance=~\"iServer.*\",job=\"events_prometheus\"}) by (cpu))"
}
Response Error :
{
"status": "error",
"errorType": "bad_data",
"error": "invalid parameter 'query': parse error at char 1: no expression found in input"
}
Just to mention that sending the same query, as a query param, will work and give us the expected results.