Board index FlightGear Development Nasal

Hello everyone

Nasal is the scripting language of FlightGear.

Hello everyone

Postby msmile024 » Tue May 08, 2018 7:21 am

Hello!

I have sought around and I have a really hard time finding definite documentation about sending HTTP requests from Nasal.

I see that it is possible, but I am unsure whether I am only able to send GET requests? And can I somehow include custom data with the request?

The HTTP API I am seeking to integrate, uses endpoints in the format of http://domain.com/x/y/z and consumes arbitrary methods and included data in JSON format.
msmile024
 
Posts: 1
Joined: Tue May 08, 2018 7:19 am

Re: Hello everyone

Postby PINTO » Tue May 08, 2018 6:58 pm

You can send info from FG to the server, but it has to be in the form of a URL query string. You can either get back a PropertyList xml file (using the fgcommand("xmlhttprequest", params)) or the whole resource (using http.load() or http.save()).

You can use, for instance http://domain.com/x/y/z?date=foo&time=bar

I am using web.py for my server-side code.
Actively developing the MiG-21bis (github repo) (forum thread) (dev discord) (fg wiki)

http://opredflag.com is an active flightgear dogfighting community (using a system that isn’t bombable)
User avatar
PINTO
 
Posts: 966
Joined: Wed Oct 21, 2015 7:28 pm
Callsign: pinto
Version: stable
OS: Win10


Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest