Page 1 of 1

Best way to make HTTP GET requests (without using tsnet...)

Posted: Sun Nov 29, 2020 2:06 am
by rodneyt
Hi all,

I'm sure there's a simple answer to this one but I seem to be having trouble finding it.

I'm wanting to perform HTTP GET requests to retrieve data from an API.

For example:

Code: Select all

GET /v1 HTTP/1.1
Host: api.marketcircle.net
User-Agent: curl/7.51.0
Accept: */*
Authorization: Bearer <redacted>
This would return back some JSON.

I see that tsnet can be used to perform GET requests but this is only available in the Indie version of Livecode which I don't have at the moment (will probably re-purchase that at some point). See: https://lessons.livecode.com/m/4071/l/8 ... a-web-site

How can I perform HTTP GET requests using standard Livecode features?

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Sun Nov 29, 2020 3:22 am
by FourthWorld
Get can also be handled with libURL, which is available in an LC editions. See the httpHeaders property to add those header values.

Is this the RodneyT from down under?

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Sun Nov 29, 2020 4:36 am
by rodneyt
Hi Richard,

Yes it's Rodney from NZ - hello :-). Thanks for that tip - works fine. I should have realised that given how much I used to use libURL. Sigh, I don't get much time for Livecode these days...

~ Rodney

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Sun Nov 29, 2020 6:57 pm
by FourthWorld
Great to see you back here, Rodney. You've had many great accomplishments with your Ocean Browser platform since we last spoke - congratulations. I hope we get to see more of you.

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Mon Nov 30, 2020 2:56 am
by rodneyt
Thanks Richard. If you would like to have a play with OB3, send me an email (rodney@oceanbrowser.com) and I'll send you an account invite.

I am building an experimental web browser to link growth-related company tasks (for example around sales or research tasks) in Livecode - using the Levure framework. I've hooked this up to Daylite CRM (currently via Applescript & Fscript code). Common tasks like adding a user to CRM, creating a note or adding a keyword can be done "direct from browser" for a more linked-up working process. As you browse pages or linked topics, a second Livecode web browser window will automatically show related pages in OB3. I'm using Livecode Javascript callbacks to control OB3 via it's client-side browser API.

All working pretty well so far. Will share more in the forum once I have it a bit more advanced.

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Wed Dec 02, 2020 2:27 am
by mwieder
Whoa! I missed this. Yes, welcome back to the fold, Rodney. Been a while since I've seen your name in these parts.

Re: Best way to make HTTP GET requests (without using tsnet...)

Posted: Wed Dec 02, 2020 3:08 am
by rodneyt
Hi Mark :-)