Forum Discussion

sengyap's avatar
sengyap
Helper I
9 years ago

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-c545db71314b/rows?key=EZ6VTdRTZXd91g45NP100eQRty1X0yWTdplsPOmNlEamuZ7PHoZIys8MPIepp255hVd884yxAM%2BCCAUDWBD3Sw%3D%3D

 

[
{
"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

    • sengyap's avatar
      sengyap
      Helper I

      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-dotnet-real-time

       

      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?

      • v-ljerr-msft's avatar
        v-ljerr-msft
        Microsoft Employee

        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

    • ayseozbek's avatar
      ayseozbek
      New Member
       
       
      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 [email protected]
      Thanks in advance Thank you ..
    • ayseozbek's avatar
      ayseozbek
      New Member
       
       
      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 [email protected]
      Thanks in advance Thank you ..
  • 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 [email protected]
    Thanks in advance Thank you ..