How to use qan-api2?

I used docker to build PMM-server in the local environment. The version is 2.25.0.

I want to use qan-api2 provided on GitHub to get the data of query-analysis, but these interfaces can’t be used.

example:
curl -s -X POST -d ‘{“period_start_from”: “2019-01-01T00:00:00Z”, “period_start_to”: “2019-01-01T10:00:00Z”, “order_by”: “num_queries”, “columns”: [“lock_time”, “sort_scan”], “group_by”: “server”}’ http://127.0.0.1:9922/v0/qan/GetReport | jq

question:

  1. Which process port is 9922?
  2. Do you need to make some settings on PMM server before using this API?
  3. Can this interface really be used
  4. Can qan-API provide more detailed documentation?
  5. Is there no permission setting for using this API? Such as key and admin password?

I can’t thank you enough for asking for help

1 Like

please help me, thank you very much!

1 Like

Hi @xiangqianforth , thank you for posting to the Percona forums!

I’m not familiar with this port, you should be using port 443/tcp in order to interact with the PMM Server

No, the API should already be fully functional as this is how for example pmm-admin communicates remotely with PMM Server.

The feature is GA so should be useful

This is a known limitation - as you discover more working examples we would appreciate you sharing them with the Community, and we would be happy to put them in our Documentation

yes you should be using the syntax and of course changing your password as needed:

curl ... --user "admin:admin" ...

may I additionally mention that we provide a swagger interface that will help you to develop the correct curl syntax. The location is simply https://PMM-SERVER/swagger/

Best of luck!

1 Like

Hi,@Michael_Coburn, Thank you for your reply!

But when I use curl command, I can’t get the correct return result. For example, my PMM server runs on 192.168.70.13.

Can you share some examples of using this API correctly? (v0/qan/GetMetricsNames)

1 Like

Hi @xiangqianforth,

If you open https://PMM-SERVER/swagger/ and replace value /swagger.json with /swagger-dev.json on the top input you will be able to see definition of QAN endpoints.

curl -X POST "https://PMM-SERVER/v0/qan/GetMetricsNames" -H "accept: application/json" -H "Content-Type: application/json" -d "{}"

Best regards,
Thanks

1 Like