curling twilio API
David Williams
dwilliams at livecode.com
Wed Sep 9 09:49:44 EDT 2015
Hi Jose,
Off the top of my head, this would probably look something like the
following in LC:
post tPostString to
url("https://AC0afb9e5c70c0fde47904a9a6ff:e6a1bdc2a7a7484d6cdc96e@api*twilio*com/2010-04-01/Accounts/AC0afb9e5c70c0fde47904a9a6ff/Messages.json")
Where tPostString contains the post fields concatenated by & (for the
example you posted):
To=5034554562&From=+1212022183&Body=test message
You can just sidestep this whole thing if you're on OSX/Linux by accessing
curl directly with shell():
get shell("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")
I would also strongly advise against posting your API keys publicly and
recommend you change the one you just posted, as there are bots which
crawl the public-facing web for such keys.
-David
On Wed, 09 Sep 2015 12:24:19 +0100, Jose Damaso <rjd318 at gmail.com> wrote:
> Hi all - can someone help me convert the following?
>
> 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
>
> I just don't have any experience working with http(s) APIs and I've been
> working through the forum posts as best I can. The only thing I've
> gathered
> so far is using urlEncode for the --data-urlencode lines. Are the -X POST
> and -u parts done in httpheaders?
>
> Any help would be greatly appreciated - thanks!
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
--
Using Opera's mail client: http://www.opera.com/mail/
More information about the use-livecode
mailing list