Reputation: 15
I have been trying to send a curl request to twilio, however request is failing. The request template is the following:
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows" \
--data-urlencode "ChannelType=whatsapp" \
--data-urlencode "Enabled=true" \
--data-urlencode "IntegrationType=studio" \
--data-urlencode "ContactIdentity=whatsapp:+xxxx" \
--data-urlencode "FriendlyName=Flex WhatsApp FlexFlow" \
--data-urlencode "Integration.FlowSid=FWxx" \
--data-urlencode "ChatServiceSid=ISxx" \
-u ACxx:yourAuthToken
I have correctly inserted some custom data on this request, but still fails. Seems like if my terminal is reading above request line by line, instead of taking it as a whole package of information. Below you could find what I get on my terminal when a look for my curl version and a image of the issue I have experience. Any idea on how to make this request right?
C:\Users\xxxx>curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL
Upvotes: 0
Views: 90
Reputation: 4837
The example and using \
to separate commands to multiple lines is usually for a Linux console.
Given that you're using Windows you need to use the caret ^
symbol for multiline commands:
curl -X POST "https://flex-api.twilio.com/v1/FlexFlows" ^
--data-urlencode "ChannelType=whatsapp" ^
--data-urlencode "Enabled=true" ^
--data-urlencode "IntegrationType=studio" ^
--data-urlencode "ContactIdentity=whatsapp:+xxxx" ^
--data-urlencode "FriendlyName=Flex WhatsApp FlexFlow" ^
--data-urlencode "Integration.FlowSid=FWxx" ^
--data-urlencode "ChatServiceSid=ISxx" ^
-u ACxx:yourAuthToken
See also this SO question: Split long commands in multiple lines through Windows batch file
Upvotes: 1