35

I have this curl command:

curl -k -d . -o SessionRequest.txt 
"https://myserver.com/MyWebApi/user?companysn=1234&login=my_login&password=my_password&ApiKey=my_api_key"

What does -d . stand for? What does it do?

Yves M.
  • 28,433
  • 22
  • 100
  • 135
user1523271
  • 865
  • 1
  • 12
  • 26

1 Answers1

43

Whenever your have a doubt use man.

Issue man curl and read about -d switch.

-d, --data <data>
    (HTTP)  Sends  the  specified data in a POST request to the HTTP
    cause curl to pass the data to the server using the content-type
    -d, --data is the same as --data-ascii. --data-raw is almost the
    ter.  To  post  data  purely  binary, you should instead use the
    [...]
    

It allows you to send ASCII data, eg.:

curl -d '{"hello": "world"}' -X POST -H "Content-Type: application/json" https://example.com

Send a JSON string to the server.

In your example, it just send a . character as ASCII data to the server. What it does depends on the server logic and is out of the curl command scope.

This said, we can guess what a . (dot, period, full stop) might mean in computer science:

  • Dot is a placeholder for the current directory in Unix File Systems;
  • Dot is a wildcard for any character in most Regular Expression grammars;
  • Dot is the separator between labels in domain name;
  • Dot is a common separator for filename and extension;

Nota: It is considered as a bad practice to send credentials using GET parameters, avoid it if you can and read more.

jlandercy
  • 5,628
  • 1
  • 35
  • 51