0

I am trying to use my own tsi environment Gen2 to simply return data from my own environment.

In Postman I can use this query to return data

{
  "getEvents": {
    "searchSpan": {
      "from": "2020-09-26T00:00:00Z",
      "to": "2020-09-29T20:00:00Z"
    },
    "timeSeriesId": [
      "10"
    ]
  }
}

whats the equivalent using tsiClient.server.getEvents? I've tried

authContext.getTsiToken().then(function(token){
                    
   tsiClient.server.getEvents(token, 'xxxxx.env.timeseries.azure.com', ???what goes here???,  {}, startDate, endDate).then(function (events) {
                        
   console.log(events)
  });
}); 

I am sure I am missing the timeSeriesId somewhere in the call to getEvent!!!

Jody
  • 323
  • 2
  • 11

1 Answers1

0

It will be an array that looks just like what you give to Postman (the SDK will batch the calls for you internally, so you can do requests for multiple timeSeriesIds or time ranges)

So this is the appropriate thing to place in ???what goes here???

[{
  "getEvents": {
    "searchSpan": {
      "from": "2020-09-26T00:00:00Z",
      "to": "2020-09-29T20:00:00Z"
    },
    "timeSeriesId": [
      "10"
    ]
  }
}]

Give that a shot and lemme know how it works. Thanks!

  • Thanks for the reply Matt, getting this : ```{"error":{"code":"InvalidInput","message":"API 'events' is not supported for environment 'xxxx'."}}``` – Jody Sep 29 '20 at 01:36
  • Also, (not related to this post) for the Vat example I had to upgrade to version ```tsiclient@1.4.0-beta.1``` to get the ProcessGraphic component but I am getting ```Uncaught TypeError: processGraphic.render is not a function at window.onload``` – Jody Sep 29 '20 at 02:25
  • Apologies for the late response! I believe you actually want to use server.getTsqResults in this case, see the example [here](https://tsiclientsample.azurewebsites.net/withplatform/PAYG.html). I've also gone ahead and fixed the process graphic example in version 1.4.8, check it out [here](https://tsiclientsample.azurewebsites.net/withplatform/processGraphic.html) and hit the page with a hard refresh to make sure it doesn't have the cached content – Matt Darsney Dec 29 '20 at 18:12