2 Replies Latest reply on Nov 7, 2018 5:17 AM by Stephen Crocker

    JSON format question from Azure Application Insights

    Stephen Crocker

      I'm trying to GET a query from Azure Application Insights to bring into tableau.  The method I was using was bringing back a bunch of unwanted results.

      Long story short.  I created a query that would run in postman and bring back the desired results but the JSON is not in the same format, it's in Tables Rows type of format.

      Has anyone worked with this and could help with how to loop through this and get it into tableau?

       

      Here is the json

      {JSON.png

          "tables": [

              {

                  "name": "PrimaryResult",

                  "columns": [

                      {

                          "name": "timestamp",

                          "type": "datetime"

                      },

                      {

                          "name": "url",

                          "type": "string"

                      },

                      {

                          "name": "user_Id",

                          "type": "string"

                      }

                  ],

                  "rows": [

                      [

                          "2018-09-25T19:51:53.9520312Z",

                          "https://dealanalyzer.azurewebsites.net/doitrade/?location=31737863-c431-e611-9420-90b11c44c42f&limit=70858860-dcf7-4b69-a04f-d13f804a5041",

                          "test@test.com"

                      ],

                      [

                          "2018-09-25T19:52:03.0066707Z",

                          "https://dealanalyzer.azurewebsites.net/doitrade/api/v1/limits?location=31737863-c431-e611-9420-90b11c44c42f",

                          "test@test.com"

                      ],

                      [

                          "2018-09-25T19:52:03.7258903Z",

                          "https://dealanalyzer.azurewebsites.net/doitrade/api/v1/reports/dealanalyzer?limit=70858860-dcf7-4b69-a04f-d13f804a5041&location=31737863-c431-e611-9420-90b11c44c42f",

                          "test@test.com"

                      ],

                      [

                          "2018-09-25T13:57:44.8168206Z",

                          "https://dealanalyzer.azurewebsites.net/doitrade/api/v1/limits?location=0bce6564-26c5-468e-84a2-2f5f59457fff",

                          "test@test.com"

                      ]

                     ]

                }

           ]

      }

        • 1. Re: JSON format question from Azure Application Insights
          Patrick A Van Der Hyde

          Helllo Stephen,

           

          I noticed that no one has replied to this thread so I am replying to get it some attention.  Have you found the issue with the JSON or do you still need assistance? 

           

          Patrick 

          • 2. Re: JSON format question from Azure Application Insights
            Stephen Crocker

            Thanks Patrick for responding.  Yeah I need a bit of help  I have added the incrementColumnID to the getSchema connector as required in the documentation.(WDC Incremental Refresh ) I'm pretty sure I'm missing something in the getData function but don't know exactly what it is.  I'm really new at this and struggling to learn it.  Here is my code for the getData area.  I do see according to the documentation documentation at the previous link it defines the var lastId but does not show an example of how to use the variable.

             

            Any help is extremely appreciated.

             

            myConnector.getData = function (table, doneCallback) {

                    var lastId = parseInt(table.incrementValue || -1);

                    var settings = {

                        "async": true,

                        "crossDomain": true,

                        "url": "https://api.applicationinsights.io/v1/apps/<appkeyhere>/events/requests?timespan=P30D&$search=lansingtradegroup",

                        "method": "GET",

                        "headers": {

                            "x-api-key": "<API Key Here>",

                            "Cache-Control": "no-cache"

                        }

                    };

             

                    $.ajax(settings).done(function (resp) {

                        console.log(resp);

                        var feat = resp.value,

                            tableData = [];

             

                        // Iterate over the JSON object

                        for (var i = 0, len = feat.length; i < len; i++) {

                            tableData.push({

                                "timestamp": feat[i].timestamp,

                                "userID": feat[i].user.id,

                                "url": feat[i].request.url

                            });

                        }

             

                        table.appendRows(tableData);

                        doneCallback();

                    });

                };