Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2020-10-09 09:16 AM
Hello Team,
I am using api of archer to check the status of package generation
Archer API : /api/V2/internal/Packages/GetManagePackageListingRows?$count=true&$orderby=Name
It works through the Archer Tool Box.
However when I am using it in powershell it is returning with 200 OK status, but with wrong values like multiple numeric output.
Below is the sample code for reference. Any help would be really appreciated
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Archer session-id=`"$session_token`"")
$headers.Add("Accept", "*")
$req = Invoke-WebRequest -Uri 'https://hosturl.com/api/V2/internal/Packages/GetManagePackageListingRows?$count=true&$orderby=Name' -Headers $headers -ContentType "application/json"
$req.Content
2020-10-09 11:32 AM
What is the response returned when it fails? For the -Uri value, add a back tick before the dollar signs since that is a special character in PowerShell.
https://hosturl.com/api/V2/internal/Packages/GetManagePackageListingRows?`$count=true&`$orderby=Name
2020-10-09 11:43 AM
Thanks Jeff for the response. I modified in uri [ i.e added + before $count ] and also removed some unwanted headers in my code and now it is working.
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Archer session-id=`"$session_token`"")
$headers.Add("Accept", "*")
$req = Invoke-WebRequest -Uri 'https://hosturl/api/V2/internal/Packages/GetManagePackageListingRows?+$count=true&$orderby=Status' -Headers $headers -ContentType "application/json"
$req.Content