Understanding CURL to Omnis example
Das Goravani
goravanis at gmail.com
Thu Mar 9 21:34:29 UTC 2023
Doug, and all,
You are referring to using the HTTP Client Worker.
Yes it has Authorization Type, and user and password
That would seem that they do the user and password inclusion for you. I see that.
The problem is that the worker has a "Contents" parameter. Normally here you put a list converted to JSON. Problem is Twilio doesn’t take JSON. I asked. They don’t. They accept "URL Encoded" only they said.
So how to put 3 items into the contents field WITHOUT JSON.
I don’t know how to type them.. what text exactly to include. The three items are From, To and Body. From and To are just phone numbers. Body has to be URL Encoded text of the text message.
I have gleaned how to type these in URL encoded form for use with HTTP Post.
I don’t know how to type them into contents for use with HTTP Worker.
Would you have a clue to that?
Das
> On Mar 9, 2023, at 2:49 PM, Doug Easterbrook via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> I suggested before to look at the omnis examples in the ’hub’
>
> Serching CURL command line paramters indicates ‘-u’ is user id and password. In the ow3 HTTP example there is a ‘user’ and ‘password’ field on the screen, that accepts input to ‘iUser’ and ‘iPassword’.
>
> searching for those two variables in the sample code yeilds the following code.
>
> so it appears that the omnis call to curl has id and password as a parameter, meaning I think that omnis does the work for you.
>
> thats the best I can help at the moment.
>
>
>
>
>
> If iSendContentMode=1
> Do iHttp.$init(iURI,iMethodList.iMethod,iHeaderList,row(iContentPath),iAuthList.iAuthType,iUser,iPassword) Returns lOk
> Else If iSendContentMode=2
> Do iHttp.$buildmultipart(iContentPath)
> Do iHttp.$init(iURI,iMethodList.iMethod,iHeaderList,kOW3httpMultiPartFormData,iAuthList.iAuthType,iUser,iPassword) Returns lOk
> Else If iSendContentMode=0
> Do iHttp.$init(iURI,iMethodList.iMethod,iHeaderList,iContent,iAuthList.iAuthType,iUser,iPassword) Returns lOk
> End If
>
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com <mailto:doug at artsman.com>
> http://www.artsman.com <http://www.artsman.com/>
> Phone (403) 650-1978
>
>> On Mar 9, 2023, at 11:41 AM, Das Goravani <goravanis at gmail.com <mailto:goravanis at gmail.com>> wrote:
>>
>> Using the CURL example and what Kelly wrote about putting it all on one line, I did this
>>
>> I am using the HTTP Post command which takes HOST and URI
>>
>> I got the host right, since I’m getting back a response, in my URI I put
>>
>> /2010-04-01/Accounts/AC75801fa7b99e6025f8816739b5ecdc9e/Messages.json?To=+14243539546&From=+15676777733&Body=Your%20Insurance%20Verification%20Number%20is%3A%20310726 -u AC75801fa7b99XXXXXXXX39b5ecdc9e:410a9c4478XXXXXXXXX2f487e7c30ae
>>
>> Note the -u and account codes following it. It is saying in the response that I am unauthorized.
>>
>> I have put in the credentials just as they show how..
>>
>> Space -u space AC:Token
>>
>> But it still says unauthorized
>>
>> Can anyone shed some light?
>>
>>
>>
>>> On Mar 9, 2023, at 2:09 PM, Das Goravani <goravanis at gmail.com> wrote:
>>>
>>>
>>> Twilio gives this CURL example as how to send them text messages.
>>>
>>> curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json <https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json> <https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json <https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json>> \
>>> --data-urlencode "To=+13105555555" \
>>> --data-urlencode "From=+12125551234" \
>>> --data-urlencode "MediaUrl=https://demo.twilio.com/owl.png <https://demo.twilio.com/owl.png> <https://demo.twilio.com/owl.png <https://demo.twilio.com/owl.png>>" \
>>> --data-urlencode "Body=Hello from my Twilio line!" \
>>> -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
>>>
>>> Kelly wrote the following:
>>>
>>> So that would mean you could send
>>>
>>> POST https://api.twilio.com/2010-04-01/Accounts/<yourID>/Messages.json?To=+13105555555&From=+12125551234&Body=Hello <https://api.twilio.com/2010-04-01/Accounts/%3CyourID%3E/Messages.json?To=+13105555555&From=+12125551234&Body=Hello> <https://api.twilio.com/2010-04-01/Accounts/%3CyourID%3E/Messages.json?To=+13105555555&From=+12125551234&Body=Hello <https://api.twilio.com/2010-04-01/Accounts/%3CyourID%3E/Messages.json?To=+13105555555&From=+12125551234&Body=Hello>> from my Twilio line!
>>>
>>> I see how to put in the To and From and Body.. but that last line.. how do you put that in.
>>>
>>> Would I put in my URL a space, then -u then space, then my codes?
>>>
>>> Would I include the single quote around my codes that they show in this example?
>>>
>>> And I would put all this into URI for the HTTP Post command? (Thus not using Contents or Headers lists)?
>>>
>>>
>>
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com <https://lists.omnis-dev.com/>
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>
>
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com <https://lists.omnis-dev.com/>
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com>
More information about the omnisdev-en
mailing list