Call Rest API inside powershell function

I have called Rest API using powershell function but i need to get date entry from all objects like english-and-wales, scotland , northern ireland. using this $list.'england-and-wales'.events.date i will get only england-and-wales details but remaining scotland, northern ireland date i am unable to fetch

function Get-Holiday {
  Invoke-RestMethod -Method Get -Uri https://www.gov.uk/bank-holidays.json

}
$list = Get-Holiday
$list | ConvertTo-Json -Depth 3
$list.'england-and-wales'.events.date

I need to get date entry from all england-and-wales, scotland, northern ireland. can you please provide solution for that

Example image



Read more here: https://stackoverflow.com/questions/64891798/call-rest-api-inside-powershell-function

Content Attribution

This content was originally published by Hafizah Channel at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: