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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
sengyap
Helper I
Helper I

Streaming Data using API

I am using a FlightStats API to collect some data on flight status.

 

I have created a API using this https://api.flightstats.com/flex/flightstatus/{protocol}/v2/{format}/flight/status/{...}

The push URl  is https://api.powerbi.com/beta/d5bc80bb-d4a9-4fbc-97cf-a2de72fdc555/datasets/ec4f8d17-8c41-4986-9ce8-c...

 

[
{
"Actual departure/arrival times" :"2016-12-22T05:16:15.330Z",
"Delay calculations" :"2016-12-22T05:16:15.330Z",
"Equipment type" :"AAAAA555555"
}
]
 
However, my dashboard is empty with no data. Did I miss out any steps? 
11 REPLIES 11
ayseozbek
New Member

Hi, I'm going to use PowerBI to get instant data from CNC machines. I have more than one field in my database. I have created one field for my code. How do I get the codes generated by drawing data?
Mailim ayseozbek6144@outlook.com
Thanks in advance Thank you ..

v-ljerr-msft
Employee
Employee

Hi @sengyap,

 

I have tested it on my side, the Power BI real-time streaming API still works for me. Could you refer to the Sample app for using the Power BI REST API for displaying real-time streaming data on dashboards to recheck your steps and your own app code?Smiley Happy

 

Regards

 
 
346/5000
 
Hi, I'm going to use PowerBI to get instant data from CNC machines. I have more than one field in my database. I have created one field for my code. How do I get the codes generated by drawing data?
Mailim ayseozbek6144@outlook.com
Thanks in advance Thank you ..

 
 
346/5000
 
Hi, I'm going to use PowerBI to get instant data from CNC machines. I have more than one field in my database. I have created one field for my code. How do I get the codes generated by drawing data?
Mailim ayseozbek6144@outlook.com
Thanks in advance Thank you ..

Thank you for your help.

 

I read the guide from your url https://github.com/Microsoft/PowerBI-CSharp/tree/master/samples/consoleapp/getting-started-for-dotne...

 

Can I just check, for step 5 and 6, do I need to type the field name as "ts" and "value"? Can I use "Actual departure/arrival times", "Delay calculations", and "Equipment type" instead?

 

For step 9, what does it mean by "copy the sample app locally"? Where do I get the sample app?

Hi @sengyap,


For step 9, what does it mean by "copy the sample app locally"? Where do I get the sample app?


You can download the sample app here.


Can I just check, for step 5 and 6, do I need to type the field name as "ts" and "value"? Can I use "Actual departure/arrival times", "Delay calculations", and "Equipment type" instead?


To illustrate the sample app, you need to type the field name as "ts" and "value", because it is hard coded in the sample app as below:

// Send POST request to the push URL
// Uses the WebRequest sample code as documented here: https://msdn.microsoft.com/en-us/library/debx8sh9(v=vs.110).aspx
WebRequest request = WebRequest.Create(realTimePushURL);
request.Method = "POST";
string postData = String.Format("[{{ \"ts\": \"{0}\", \"value\":{1} }}]", currentTime, currentValue);
Console.WriteLine(String.Format("Making POST request with data: {0}", postData));
                    
// Prepare request for sending
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentLength = byteArray.Length;

// Get the request stream.
Stream dataStream = request.GetRequestStream();

// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);

// Close the Stream object.
dataStream.Close();

If you want to use "Actual departure/arrival times", "Delay calculations", and "Equipment type" instead, you need to rewrite your own app correspondingly.

 

Regards

Hi @v-ljerr-msft,

 

Thank you for sending me the sample app file, but there are quite a few documents in the file, which one do I use? Do I need any external program to run the sample app?

 

Regards

Hi @sengyap,

  1. Go to app.powerbi.com
  2. Go to streaming data management page by via new dashboard > Add tile > Custom Streaming Data > manage data
  3. Click "Add streaming dataset"
  4. Select API, then Next, and give your streaming dataset a name
  5. Add a field with name "ts", type DateTime
  6. Add a field with name "value", type Number
  7. Click "Create"
  8. Copy the "push URL" at the top of the page
  9. Copy the sample app locally, and in Program.cs, paste url copied in step 8 as the value of "realTimePushURL"
  10. Run the sample app
  11. With the sample app running, go to the dashboard, and create a real-time tile with with the data provided by the sample app


Yes, you need to run the sample app with your Visual Studio locally by selecting "PBIRealTimeStreaming.sln" in "PowerBI-CSharp-master\samples\consoleapp\getting-started-for-dotnet-real-time\PBIRealTimeStreaming" folder.Smiley Happy

 

Regards

Hi @v-ljerr-msft,

 

I was reading this post as i was searching for a sample app which uses Power BI Rest APIs to push data into datasets. However all the links here in this post are expired. Can you kindly redirect me to these sample applications.

 

If in case you are also not able to find, will it be possible for you to share with me that sample application which you guys used to send data to Power BI streaming dataset?

 

Thanks

Prateek Raina

@v-ljerr-msft Do I need to run the sample app everytime to load the API or will it automatically update itself?

Hi @sengyap,

 

Yes, you need to run the sample app or your own custom app to update the data.

 

Regards

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors