Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

Powershell & API hooks failing

Trying to use powershell to pull pull information from samanage but I keep getting an error when just testing the authentication part documented here

Below is the code I am running with my token removed.



$token = 'TOKEN' 
$apiver = 'Accept: application/vnd.samanage.v2.1+json' 
$apiurl = '' 

curl -H 'X-Samanage-Authorization: Bearer $token' -H $apiver -H 'Content-Type: application/json' -X GET $apiurl + incidents.json



 And then here is the error I get:


EDIT: I did some google searching for the error and everything i found basically said to do it differently but none of it was related to SWSD.

0 Kudos
1 Reply
Level 7


Give this a try instead:

$token = 'TOKEN'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" 
$headers.Add("Accept", 'application/vnd.samanage.v2.1+xml')
$headers.Add("X-Samanage-Authorization", "Bearer $token")
$apiurl = '' 

curl -H $headers -X GET $apiurl + incidents.json


0 Kudos