10-24-2018 03:26 PM
Hi there, my question is about getting historical data across the Citadel web service. I am using Labview 2017 and the DSC Module and running the example given by NI in "Find Examples/ Toolkits and Modules/ Dataloging and Supervisory Control/ Data and Alarm Historical Logging/ Database Direct write Demo.lvproj.
On this document we can find how to use the webservice
I am trying to acces historical data using the webservice API, and the documentation says I could specify many parameters for a desired response from the server. My necesity is this:
So, I think the URL for my request should look like this:
http://localhost:3580/nicitadel/trace/PORTJOCARR3/My_Process/MyTrace?OUTPUT_FORMAT=JSON&start=2018-10-23T14:15:33-06:00&end=2018-10-23T14:15:35-06:00
It suposed that I will receive a dataset with all the data between the START and END timestamps, but the server is giving me this Response
I've used Postman for testing the API, but any Web Browser will work.
Solved! Go to Solution.
10-24-2018 08:21 PM
It looks like the response you're getting is valid with status code 200 and a valid JSON message.
I tried the example VI you're using, and it's writing bad data. Or rather, it's writing with a very small time interval (0.5ms) which can't be queried via the web service. Heck, Citadel only really supports 1ms data, and that's pushing it to the limit. 100ms is much more reasonable.
If you modify the example VI and set the wavform dt to something more sensible, say 0.1s, then run it, then run your web service it should work.
Example of web service response:
{ "firstTimestamp":"2018-10-25T09:18:16+08:00", "sampleInterval":1, "data": [0.000000,0.270000,0.560000,0.790000,0.940000,0.990000,0.970000,0.83...(more data not shown)
10-25-2018 12:54 PM - edited 10-25-2018 12:54 PM
Thank you MichaelBalzer, definitely this is the answer. And it's confirm I was confuse in the way Citadel store logs. But this drive me to three more questions:
10-25-2018 09:59 PM
I'm not overly familiar with the web services side of Citadel, so these are just my best guesses. Perhaps someone from NI can respond?
1. Based on the JSON response, yes.
2. I'm guessing it'll interpolate the values to the nearest time interval, but is probably worth verifying.
3. Not as far as I can see. It looks like the web service response only provides t0 and dt, and the documentation doesn't mentioned anything about a timestamp per data point. So you'll need to calculate timestamps.
10-29-2018 09:48 AM
I appreciate all your help. I think your guesses are right too. The documentation has a lack of exmples
10-23-2020 07:50 AM
Hello! Question on this topic.
How can I change the decimal point in the JSON response?
Changing the settings for language and regional settings do not help ...