convert POST to livecode for twilio
Posted: Wed Sep 09, 2015 12:01 am
Hi all, I'm having trouble trying to use the Twilio messaging API. This is my first attempt at this and I'm sure I'm reading other forums posts on how this is done and not comprehending correctly. Here's the CURL sample request that I am trying to convert
curl -X POST 'https://api*twilio*com/2010-04-01/Accounts/AC0afb9e5c70c0fde47904a9a6ff/Messages.json' \
--data-urlencode 'To=5034554562' \
--data-urlencode 'From=+1212022183' \
--data-urlencode 'Body=test message' \
-u AC0afb9e5c70c0fde47904a9a6ff:e6a1bdc2a7a7484d6cdc96e
... and so far I have ...
put urlEncode("To=8086306498") & "&" & \
urlEncode("From=+18082022182") & "&" & \
urlEncode(tMsg) into tParams
put URL "https://api*twilio*com/2010-04-01/Accounts/AC0afb9e5c70c0fde47904a9a6ff/Messages.json" & tParams into tResults
it seems like I am missing the conversion of the line '-u AC0afb9e5c70c0fde47904a9a6ff:e6a1bdc2a7a7484d6cdc96e' that is the account and auth token. Can someone point me in the right direction on how to supply the API with the -u piece? Or if I'm totally off on this, how it can be done? Thanks!
curl -X POST 'https://api*twilio*com/2010-04-01/Accounts/AC0afb9e5c70c0fde47904a9a6ff/Messages.json' \
--data-urlencode 'To=5034554562' \
--data-urlencode 'From=+1212022183' \
--data-urlencode 'Body=test message' \
-u AC0afb9e5c70c0fde47904a9a6ff:e6a1bdc2a7a7484d6cdc96e
... and so far I have ...
put urlEncode("To=8086306498") & "&" & \
urlEncode("From=+18082022182") & "&" & \
urlEncode(tMsg) into tParams
put URL "https://api*twilio*com/2010-04-01/Accounts/AC0afb9e5c70c0fde47904a9a6ff/Messages.json" & tParams into tResults
it seems like I am missing the conversion of the line '-u AC0afb9e5c70c0fde47904a9a6ff:e6a1bdc2a7a7484d6cdc96e' that is the account and auth token. Can someone point me in the right direction on how to supply the API with the -u piece? Or if I'm totally off on this, how it can be done? Thanks!