How to access influxdb through rest api

#1

I am trying to see list of series through python code using rest end point support of influx , it works fine with curl But i am getting errors with python code , here is my code

import requests

url = “http://localhost:8086/query

querystring = {“pretty”:“true” --data-urlencode “db=test” --data-urlencode “q=show series limit 10"”}

headers = {
‘authorization’: “Basic cm9vdDpyb290”,
‘cache-control’: “no-cache”,
‘postman-token’: “1a60d381-b7ac-4113-1a59-ce482f8528e8”
}

response = requests.request(“POST”, url, headers=headers, params=querystring)

print(response.text)

Output:{“error”:“missing required parameter “q””}

#2

Hi!

This error is usually related to formatting. I would check that the content-type is correct and that the formatting of your strings is correct. Specifically “q = show series limit 10” may not be allowed to have spaces.