Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using TCL for interfacing with REST API

1,174 views
Skip to first unread message

pat...@gmail.com

unread,
May 18, 2014, 3:59:54 PM5/18/14
to
Hello all,

I use Tcl 8.4 on Windows 7 and looking for actual examples of where TCL is used to interface with a public REST API?

I see there is a TclCurl package. Is that recommended or just use HTTP?

The APIs I would be interfacing with use YANG and possible JSON data models.

I had previously written scripts to create XML requests and send over HTTP, but REST is slightly different.

I am trying to do a very simple example using TCL to talk to any public RESTful website. If anyone has done this, please let me know.

Can HTTP package do everything TclCurl can do?

Thank you!

Robert Heller

unread,
May 18, 2014, 5:46:06 PM5/18/14
to
At Sun, 18 May 2014 12:59:54 -0700 (PDT) pat...@gmail.com wrote:

>
> Hello all,
>
> I use Tcl 8.4 on Windows 7 and looking for actual examples of where TCL is used to interface with a public REST API?
>
> I see there is a TclCurl package. Is that recommended or just use HTTP?

I'd just use the HTTP package.

>
> The APIs I would be interfacing with use YANG and possible JSON data models.

There is a JSON library in the tcllib package.

>
> I had previously written scripts to create XML requests and send over HTTP, but REST is slightly different.
>
> I am trying to do a very simple example using TCL to talk to any public RESTful website. If anyone has done this, please let me know.
>
> Can HTTP package do everything TclCurl can do?
>
> Thank you!
>

--
Robert Heller -- 978-544-6933 / hel...@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments



Rich

unread,
May 18, 2014, 5:45:27 PM5/18/14
to
pat...@gmail.com wrote:
> Hello all,

> I use Tcl 8.4 on Windows 7 and looking for actual examples of where
> TCL is used to interface with a public REST API?

Why on 8.4? 8.6 has been out now since 2012-10-20. You are missing
out on all the 8.5 goodness and 8.6 goodness by sticking with 8.4.

> I see there is a TclCurl package. Is that recommended or just use
> HTTP?

Depends upon your purpose, needs, and wants. The http package is pure
Tcl, so you have nothing to install. TclCurl is a compiled extension,
so you'll need a loadable library module for each architecture you
intend to target.

> Can HTTP package do everything TclCurl can do?

Given enough Tcl wrapping, I'd say yes.

But TclCurl can probably do some things out of the box that would
require a fair amount of code to prepare the data prior to using the
basic http package.

Gerald W. Lester

unread,
May 18, 2014, 10:18:59 PM5/18/14
to
As others have said, I'd strongly urge you to use 8.6 not 8.5.

At https://code.google.com/p/freshbooks-api-tcl/ is an example of using
TclWs (http://core.tcl.tk/tclws) to communicate to a RESTful XML based API.

I've also used JSON to extract data from SourceForge (in particular the
Feature Request, Bugs, and Patches for TclHttpd) as part of the move of
TclHttpd to a Fossil DSCM from SourceForge. I'm currently planning on
co-authoring a paper for this year's Tcl/Tk Conference on the move and tools
used.

Both of the above used the HTTP package, plus maybe tls, and not TclCurl.

--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+
0 new messages