• 0

Need assistance exporting datasources out with API and converting to CSV


Alastair Batstone
 Share

Question

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

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Administrators

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. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share