0

I have been able to use curl to issue a query and return a result or series of named parameters. I want to issue a POST command on these series of named parameters, but the "multiple" is tripping me up. I can issue the POST command on one of the parameters, but not on the entire series of them.

The command I'm using within powershell is

curl.exe -u username:password -X POST http://site.url:8042/modalities/MCTEST/store -d '["6a3eb7c4-a9d83950-24d36e94-5c20d248-0b5ce989","8c93b430-757278ab-21ab643c-c98aa03d-da14148e","b8f648fa-175de243-de76b1c0-2dc7551a-928b86a5","c865b966-f0c7d2c2-0a1114e0-80531305-31cd104e","aac7f73f-fcb922ef-b950c4c1-ee1d512e-e2aeb5ae"]'

If I issue the command on only one, it processes fine...obviously, I don't need quotes or brackets, which I think is what is tripping me up.

curl.exe -u username:password -X POST http://site.url:8042/modalities/MCTEST/store -d 6a3eb7c4-a9d83950-24d36e94-5c20d248-0b5ce989

I've tried subbing the double quotes with a backslash, tried adding a backslash, I've tried everything i can think of...I'm missing something.

I get a response of "must provide a json value" I'm not sure what my error is in my syntax. Any ideas?

Drew
  • 3,814
  • 2
  • 9
  • 28
arvetus
  • 1
  • 2

1 Answers1

0

external commands have to be called/quoted properly

PowerShell: Running Executables

Solve Problems with External Command Lines in PowerShell

Top 5 tips for running external commands in Powershell

Execution of External Commands in PowerShell Done Right

Using Windows PowerShell to run old command-line tools (and their weirdest parameters)

See also about Redirection

Powershell: Pipe external command output to another external command

How to use the curl command in PowerShell?

Stackoverflow example by Ansgar Wiechers

$CurlArgument = '-u', 'xxx@gmail.com:yyyy',
                '-X', 'POST',
                'https://xxx.bitbucket.org/1.0/repositories/abcd/efg/pull-requests/2229/comments',
                '--data', 'content=success'
$CURLEXE = 'C:\Program Files\Git\mingw64\bin\curl.exe'
& $CURLEXE @CurlArgument
postanote
  • 15,138
  • 2
  • 14
  • 25