Pass X-API-Key to curl header

Viewed 2407

My orginal request is below and it was ok:

curl -X GET --header 'X-API-Key: myapikey' 'myurl'

But i want to receive X-API-Key from ~/.netrc file:

machine myhostname 
    login administrator
    password myapikey

My second request is:

curl -v -X GET 'myurl'

The error below:

{"status": 401, "detail": "No authorization token provided"}

What am I doing wrong? How to pass X-API-Key to curl command by using .netrc?

1 Answers

The login and password in .netrc will be add to "Basic Authorization".

.Netrc

Related