0

This command works fine if I paste into a command window directly:

curl -X POST -H "Content-type: application/json" --data "{\"text\":\"test\"}" --url "https://chat.googleapis.com/v1/spaces/[removed]/messages?key=[removed]&token=[removed]"

yet when I execute this from within a batch file, I receive the following:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

I've tried every permutation of escaping the quotes in the json data statement with no luck.

Til
  • 5,150
  • 13
  • 26
  • 34

1 Answers1

0

I found the issue - it's not even illustrated in the sample I posted as I had removed the URL. The issue related to a % symbol I had in the URL - in a batch script these need to be escaped by entering %% instead of %. Hope this saves someone the hours I wasted on such a stupid mistake. Thanks to those who reviewed or responded - sorry to have wasted your time :-(