Forum Discussion

Jeff_Batchelor's avatar
9 months ago

PowerShell to Get Alerts through API with ticketid

I am trying to utilize the PowerShell cmdlets from PowerShell gallery to pull back alerts from our portal from a specific time windows and include the ##externalticketid## field.

In Python it says to update the queryParams with customColumns=%2523%2523externalticketid%2523%2523 but that does not seem to work in PowerShell.

Has anyone been able to utilize the API to pull back alerts and include the ##externalticketid## field so you can relate it to things like the ServiceNow INC being created for LogicMontior Alerts?

This is using API v2.

  • Hey y’all, so the old V1 documentation does include this still. 

    However, it looks like the v2 and v3 swagger docs have been corrected to remove the “customColumns” being available as a parameter.  This is due to performance impacts that parameter had on the “alert/alerts” api endpoint.  Instead, if you need to pull custom columns you will need to make the API call to “alert/alerts/{ID}” where it is still a valid parameter. 

    https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Alerts/getAlertById 

    The URL encoding does remain the same as what is described in the v1 article:

    %2523%2523externalticketid%2523%2523