Forum Discussion

Alastair_Batsto's avatar
4 years ago

Need assistance exporting datasources out with API and converting to CSV

Followed the instructions here https://www.logicmonitor.com/support/rest-api-developers-guide/v1/datasources/get-datasources

Exports out to a .json file ok, but only seems to read the first 50 "records" into the CSV.  Have set $resourcePath = '/setting/datasources' and QueryParams = '?size=1800' and it produces 1534 records but the PS "convertfrom-json" seems to truncate at 50!?

Would someone have a method/script that works.  Thanks

Alastair

2 Replies

  • I might start with a suggestion from someone about using the LogicMonitor Powershell scripts...

  • Anonymous's avatar
    Anonymous

    Max size on that call is 1000. If you're passing in 1800, it might be discarding that query parameter as invalid and only returning the first 50 DSs, which is the default size. 

    If you're stuck on powershell, i'm afraid someone else will have to chime in. However, if you're open to it, i'd consider python. The Python SDK is pretty powerful and fairly easy to use.

    Out of curiosity, what's your goal in exporting the DSs? I know of some other community members who do this regularly and check into a git repo in order to track changes to the DSs.