Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Check the status of Package Generation using Archer API

NitinTiwari
Contributor III

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

2 REPLIES 2

JeffLetterman
Archer Employee
Archer Employee

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

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