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

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rodneyt
Posts: 128
Joined: Wed Oct 17, 2018 7:32 am

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

Post by rodneyt » Sun Nov 29, 2020 2:06 am

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?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Sun Nov 29, 2020 3:22 am

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?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

rodneyt
Posts: 128
Joined: Wed Oct 17, 2018 7:32 am

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

Post by rodneyt » Sun Nov 29, 2020 4:36 am

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Sun Nov 29, 2020 6:57 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

rodneyt
Posts: 128
Joined: Wed Oct 17, 2018 7:32 am

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

Post by rodneyt » Mon Nov 30, 2020 2:56 am

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

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

Post by mwieder » Wed Dec 02, 2020 2:27 am

Whoa! I missed this. Yes, welcome back to the fold, Rodney. Been a while since I've seen your name in these parts.

rodneyt
Posts: 128
Joined: Wed Oct 17, 2018 7:32 am

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

Post by rodneyt » Wed Dec 02, 2020 3:08 am

Hi Mark :-)

Post Reply