From: Iuri de A. S. <iu...@iu...> - 2021-02-21 23:33:47
|
Hello there, I’m trying to rewrite a CURL request to Naviserver. curl 'https://api.twilio.com/2010-04-01/Accounts/ACe13c882f57e87c4b4db37/Messages.json' -X POST \ --data-urlencode 'To=whatsapp:+5511998865465' \ --data-urlencode 'From=whatsapp:+14155238886' \ --data-urlencode 'Body=Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be delivered on July 10, 2019. Details: http://www.yummycupcakes.com/' \ -u [Authkey]:[AuthToken] man url -u, --user <user:password> Specify the user name and password to use for server authentication. Overrides -n, --netrc and --netrc-optional. If you simply specify the user name, curl will prompt for a password. … So basically, data-urlencode becomes posta_data. How could -u argument can be rewritten to [ns_http run …] arguments set post_data [list] lappend "[ns_urlencode to]=[ns_urlencode whatsapp:+5511998865465]" lappend "[ns_urlencode From]=[ns_urlencode whatsapp:+14155238886]" lappend "[ns_urlencode Body]=[ns_urlencode \"Your Yummy Cupcakes Company order of 1 dozen frosted cupcakes has shipped and should be deli\ vered\"]" set url "https://api.twilio.com/2010-04-01/Accounts/ACe13c431f82f57e87c4b4db37/Messages.json" set res [ns_http run -method POST -headers $req_headers -body $post_data $url] ns_log Notice "RES2 $res" I was looking for references in the documentation, however I haven’t found any matches. What's the replacement of curl -u in ns_http? References: https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html <https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html> Best wishes, I |