Blog Post

Tech Talk
1 MIN READ

Device DataSource Instance datapoint historical data using RestAPI v3

Cole_McDonald's avatar
Cole_McDonald
Icon for Professor rankProfessor
2 years ago

I am having problems getting the RestAPI to return any data regardless the combination of paths, query params, time filters I try using.  What am I doing wrong?  Here’s my ultimate URL I’ve built for this effort:

$ddsi is a successfully retrieved object (DeviceDataSourceInstance)

Start and End are from these:

    [int]$start = get-date (get-date).addMonths(-3) -uformat %s
    [int]$end   = get-date (get-date).addMonths(-3).AddMinutes(5) -uformat %s

/device/devices/$($ddsi.deviceid)/devicedatasources/$($ddsi.devicedatasourceid)/data?size=500&offset=0&start=$start&end=$end&datapoints=Capacity,PercentUsed

All of the pieces and parts seem to line up with examples I’ve found here and in the LM Docs… it doesn’t error out, but returns nothing.

Goal is to get volume capacity metrics from 3 months ago.

Where am I going awry here?  Everything works up until I add the /data at the end.

Published 2 years ago
Version 1.0
  • I can give it a shot and revisit postman… looks like there’s no longer a purely local option (have to make the free account now).  My tinfoil hat doesn’t like it as much.  Nothing seems to indicate where they’re storing data with the new version… I’ll have to read through their documentation now to verify.

  • Make sure it works in postman first. That will tell you if the problem is your request or your script.

    I’ve never been able to get postman to work right with LM’s API… even while taking the LMCD :)

    I’ve just used my own code for it as a result.

    With the move to Bearer Token for auth, you don’t need a prescript any longer. Which makes using tools like Postman or Insomnia that much easier.

  • Once I get these grabs figured out, I’m going to start building longer term predictive metrics.  Things like 3 month, randomly sampled standard deviations to determine steady or spiky used volume growth.  This will unlock growth metrics like “Days Until Full” and “Desired Capacity” to determine how best to address a volume that is filling up… fix some SQL backup that didn’t complete and delete the previous one… a single users storing a copy of GoT Red Wedding episode video file (that sounds awfully specific Cole)… or nice steady growth that can just be expanded to let it meet a quarter’s growth and allow an account manager to spend some quality time with the clients who don’t want as much interaction, so we can find ways to determine if their technology needs may be changing or suggest other optimizaitons/solutions where needed.

  • Make sure it works in postman first. That will tell you if the problem is your request or your script.

    I’ve never been able to get postman to work right with LM’s API… even while taking the LMCD :)

    I’ve just used my own code for it as a result.

  • Anonymous's avatar
    Anonymous

    Make sure it works in postman first. That will tell you if the problem is your request or your script.