HTTPS rest api download using requestPromise



I am trying to build a dynamic song list, everyday users get a fresh song list from the server using REST call, and then that list will get updated to a local file, which will use that data for day’s duration. I am not sure if we can override the file, I tried using the below code, while I am able to get rest data with HTTP, HTTPS doesn’t work. Could you please guide me if its a better approach or not and also how to handle HTTPS calls.

async function getSongsList() {
// Do API call and return data
const options = {
    // uri: '',
    // uri: '',
    uri: '',
    json: true // Automatically parses the JSON string in the response
const data = await requestPromise(options);
const songdata = data.starWarsQuote;

// fs.writeFileSync("./input/pravchan.json",songdata,{encoding:'utf8',flag:'w'});
try {
    fs.writeFileSync("./input/pravchan.json", songdata)
  } catch (err) {
// return quote;


Here’s a tutorial how to make API calls inside a jovo app:

Btw. Just in case you use AWS Lambda. Please note that you cannot save files in Lambda.


I thought we can’t create new file but you can update existing files? What would be other way to achieve this?