Forum Discussion
Automatically refresh
Hello.
Could someone help me please to automate the refresh of the data sources?
What I am doing now is to call a Postman collection in Microsoft Visual Studio Code (saving the results by executing a .js file).
Everytime I execute the file, I get my data source refreshed, and I know I can set up a Schedule Refresh in the portal for each data set.
The problem is that I can only execute the file while at work`s computer, because there is everything installed.
If I go on holiday or work from home, I am not able to refresh the data.
What are you using to get the data source updated and will someone help me to do it please?
I don`t know how to use Azure to create a SQL database and populate it and I cannot get the data through Web option on Microsoft Power BI Desktop.
Please help 😞
Thank you
8 Replies
- bcdobbs
Community Champion
We should be able to move the postman collection into an api call within power query. Are you able to share your existing vs code script? (Blank out any api keys)
- Alexandra_B
Helper III
This is the code in .js :
const newman = require('newman'); // require newman in your project const fs = require('fs'); // call newman.run to pass `options` object and wait for callback newman.run({ collection: require('./Name_of_the_collection.postman_collection'), reporters: 'cli' }).on('request', (error, data) =>{ if (error) { console.log(error); return; } const fileName = `response ${data.item.name}.json`; const content = data.response.stream.toString(); fs.writeFile(fileName, content, function (error) { if (error) { console.error(error); } }); });I have API key and authorization details on Postman when calling each API
- bcdobbs
Community Champion
Do you have any documentation on the api you're using. Basically how it authenticates/paginates?