Raw API access 401 with god-mode token

I’m using the free plan to get acquainted with influxdb and I have created a token that should be able to provide access to everything.

When I use the token (via curl) to get my buckets all works fine, but when I use that same token and try to POST data I get a 401.

So this works:

curl https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/buckets \ 
-H 'Authorization: Token MyVerySecretToken=='

But this results in a 401:

curl -X POST https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/write?bucket=mybucket&org=myorg \ 
-H 'Authorization: Token MyVerySecretToken==' \
--data-raw 'test_data,host=cmd-curl value=1'

I verified my org and bucket names and they match. I also tried using the unique id’s, but both gave me the same result.

Is there anything else I can try?

Solved!!!

I needed the quote the url too as it contains an ampersand which is interperted by bash. That’s all… everything after the ampersand was not sent.

curl -X POST 'https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/write?bucket=mybucket&org=myorg' \ 
-H 'Authorization: Token MyVerySecretToken==' \
--data-raw 'test_data,host=cmd-curl value=1'

I leave this post here as a punishment for me because I’ve should have known this :face_with_peeking_eye: … and just maybe this could be of help to others when they stumble across this post.