To set the precision in CLI you write precision <RFC3339|h|m|s|ms|us|ns> in the command line depending on what precision you want. The default value of the precision for the CLI is nanoseconds.
To set the precision in HTTP API you pass epoch=<h|m|s|ms|us|ns> as a query parameter. The default value of the precision is RFC3339.
query
influx -database "db" -execute 'select * from table'