Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

To make an APIcall to access a file on disc we need to use a webserver. To spin up a webserver, navigate to the folder you would like to be able to access and run:

python3 -m http.server --cgi 8080

The only thing that you will need to do is change the APIcall to use a “GET” method since this webserver has some limitations.

In this example you can try using the on loaded event to fire off an APIcall. The file “example.json” is a file that is located in the folder that the webserver is running.

READYevent(function(){
   var Path = "example.json";
   APIcall(Path,{},APIsuccess);
});

function APIsuccess(Data){ console.log("Successful API call", Data); }

For more reading about starting a simple webserver

  • No labels