Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need help publishing Javascript data to Streaming Dashboard

I am trying to create an example of a streaming dashboard in Power BI using a javascript random number generator with a date stamp. I have created the Javascript to get the values I need, but I don't know how to use the URL or cURL or Powershell to publish the fake data my Javascript is producing. Any help would be greatly appreciated. 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Do you store the values somewhere? If not, I would suggest you use JS to push the data into Power BI. Please refer to the demo below.

1. Install Node.js.

2. Install the module "request".

3. Try the code below.

var request = require('request');


// the URL of Power BI streaming dataset.
var target_url = "https://api.powerbi.com/beta/*************************g%3D%3D"
// the data to push. It should be the values generated by JS to you.
var raw_data = {'ID': 1999, 'Name': "Jack"}
// convert a object to JSON.
var data_to_post = JSON.stringify(raw_data)


const req = request.post(target_url, data_to_post, (error, res, body) => {
    console.log(`Status code: ${res.statusCode}`);
});

req.on('error', (e) => {
    console.log("error: " + e.message);
});

req.write(data_to_post);
req.end;

Need-help-publishing-Javascript-data-to-Streaming-Dashboard

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Do you store the values somewhere? If not, I would suggest you use JS to push the data into Power BI. Please refer to the demo below.

1. Install Node.js.

2. Install the module "request".

3. Try the code below.

var request = require('request');


// the URL of Power BI streaming dataset.
var target_url = "https://api.powerbi.com/beta/*************************g%3D%3D"
// the data to push. It should be the values generated by JS to you.
var raw_data = {'ID': 1999, 'Name': "Jack"}
// convert a object to JSON.
var data_to_post = JSON.stringify(raw_data)


const req = request.post(target_url, data_to_post, (error, res, body) => {
    console.log(`Status code: ${res.statusCode}`);
});

req.on('error', (e) => {
    console.log("error: " + e.message);
});

req.write(data_to_post);
req.end;

Need-help-publishing-Javascript-data-to-Streaming-Dashboard

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.