API select: Help removing data from response


I’d like to reduce the output I receive when using the API to query my InfluxDB.

Here’s my current method/select query to get the data:

curl --insecure --get https://IPADDRESSHERE:8086/query?db=DATABASEHERE --header “Authorization: Token TOKENHERE” --data-urlencode “q=SELECT last(value) FROM DATABASEHERE.autogen.MEASUREMENTHERE WHERE time > now() -3s”

Here’s the output:


What I’d like to get is just the ‘4’ in response, or at least something a little less that I can then work on.

Is there a way to tweak the query to reduce the output?

Found a method using a Linux package called ‘jq’.

The curl results need piping to:

| jq '.results[].series[].values[][1]'

Which gives me:


Hope that helps someone else in the future

Hello @olliecampbell,
Thanks for sharing your solution!!