In order to select first matching record found using XPATH query I used
(//div[@class='container']//h1[@class='page-header'])[1] instead of //div[@class='container']//h1[@class='page-header'][1]
ASP.NET, C#.NET, CruiseControl.NET, Microsoft SQL Server, MS-DOS Batch, MySQL, nAnt, NodeJs, PowerShell, Python, Selenium RC, Redis, WebAii, Ubuntu
Wednesday, November 23, 2016
Thursday, November 10, 2016
Web Request using PowerShell and Parse JSON response as PowerShell object
To send web request and read JSON response using PowerShell I used following commands
$response = Invoke-WebRequest -Uri "http://myserver.com" -Method Get -Headers @{"apikey"="toekn"}
$responseAsPSObject = $response.Content | ConvertFrom-Json
$myValue = $responseAsPSObject.Value."mykey"
Write-Host "$myValue"
$response = Invoke-WebRequest -Uri "http://myserver.com" -Method Get -Headers @{"apikey"="toekn"}
$responseAsPSObject = $response.Content | ConvertFrom-Json
$myValue = $responseAsPSObject.Value."mykey"
Write-Host "$myValue"
Subscribe to:
Posts (Atom)