I am working on configuring Twilio as a remote web service. I've run into a snag in that I cannot figure out how to pass the --data-urlencode fields. I set up the edmunds remote web service on DreamFactory following the example and I am able to pass query parameters through that web service.
The curl example from Twilio's site shows:
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/AC5ef872f6da5a21de157d80997a64bd33/Messages.json' \
--data-urlencode 'To=+16518675309' \
--data-urlencode 'From=+14158141829' \
--data-urlencode 'Body=Hey Jenny! Good luck on the bar exam!' \
-d 'MediaUrl=http://farm2.static.flickr.com/1075/1404618563_3ed9a44a3a.jpg' \
For the -u field I set up under config in remote web services for CURL options CURLOPT_USERPWD with a value equal to AccountSid:AuthToken.
This seems to get passed through and if I run the curl command with no query parameters I get a response back from Twilio listing all the messages in my account. However, when I try to pass the query parameters I get an error message ("From number is required").
This is the curl command which returns a list of messages from Twilio (i.e. it works):
curl -i -k -3 -X GET "http://localhost:8080/api/v2/twiliomsgs/" \
-H "X-DreamFactory-Api-Key:" \
And this is the one which does not work:
curl -i -k -3 -X POST "http://localhost:8080/api/v2/twiliomsgs?To=%2B14152030606&From=%2B15103583700&Body=Hello" \
-H "X-DreamFactory-Api-Key:key" \
I also tried passing To, From, and Body via --data-urlencode instead of in the URL to DreamFactory as in the Twilio example but that did not work either.
I was wondering if anyone has set up Twilio or a similar service and has some suggestions to try.
I'm on DreamFactory 2.1.0.
For reference Twilio SMS REST API Docs