Powershell not accepting cURL call

Viewed 90

I want to make an API call from the terminal. This is what I am doing: I downloaded curl and added the location of curl.exe to the path variable. Next I am making this call from Windows Powershell

curl 'https://api.twilio.com/2010-04-01/Accounts/XXSomeNumberXX/Messages.json' -X POST \
--data-urlencode 'To=+9191314080' \
--data-urlencode 'From=+12074776' \
--data-urlencode 'Body=Testing API call to send SMS' \
-u XXSomeStringXX:XXAuthorizationTokenXX

I have hidden the phone numbers and authorization credentials here for security reasons. The above call is right and it works on Mac but not on Windows. This is the error it generates:

At line:2 char:3
+ --data-urlencode "To=+9191314080"\
+   ~
Missing expression after unary operator '--'.
At line:2 char:3
+ --data-urlencode "To=+9191314080"\
+   ~~~~~~~~~~~~~~
Unexpected token 'data-urlencode' in expression or statement.
At line:3 char:3
+ --data-urlencode "From=+12074776"\
+   ~
Missing expression after unary operator '--'.
At line:3 char:3
+ --data-urlencode "From=+12074776"\
+   ~~~~~~~~~~~~~~
Unexpected token 'data-urlencode' in expression or statement.
At line:4 char:3
+ --data-urlencode "Body=Testing API call to send SMS"\
+   ~
Missing expression after unary operator '--'.
At line:4 char:3
+ --data-urlencode "Body=Testing API call to send SMS"\
+   ~~~~~~~~~~~~~~
Unexpected token 'data-urlencode' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingExpressionAfterOperator

I have tried changing quotations to apostrophes but it doesn't work. What is wrong here?

0 Answers
Related