Getting data from API Error Trigger

Product: PowerShell Universal
Version: 3.7.3

I have a API error trigger configured and im trying to get that data from the response and the request but i am struggling. Anyone have any ideas?

in my APIError.ps1 script that the trigger calls I have the param block

param (
    $Data
)

$Data

I think you should be able to just access those properties on data.

$Data.Request

Is that not working?

That did not work for me. I tried all the things but no luck.

Something that is weird is that 1 in the pipeline output. I can give this a shot myself in a bit but maybe it’s passing some other object in there?

$Data[1].Request

The PSSerializer is currently only serializing the metadata for triggers to 1 depth. Because of this, you can’t access the request\response properties. We’ll get this fixed in 3.7.7.

Thanks for looking into it. This will be a helpful feature for us as we are using them to send alerts to webhooks.

Better:

As much data as we can get from the api call that failed the better imo. :smiley:

1 Like