Sending json files in curl requests with absolute or relative paths

The -d @ command option accepts any resolvable file path, as long as the path actually exists. So you could use:

  • a path relative to the current directory
  • a fully qualified path
  • a path with soft-links in it
  • and so on

To wit, just the same as hundreds of other *Nix style commands. One quick note, the -d option will attempt to url encode your data, which from what you describe isn’t actually what you want. You should use the --data-binary option instead. Something like this:

curl -XPOST
     -H 'Content-Type:application/json'
     -H 'Accept: application/json'
     --data-binary @/full/path/to/test.json
     http://localhost:8080/easy/eservices/echo -v -s

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)