Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..

cancel
Showing results for 
Search instead for 
Did you mean: 

Error while calling contentapi

grv.mishra
Collaborator III

I am trying to call contentapi using below code but I am getting error, I can access content api from browser and getting all the endpoint. Am I doing something wrong.

 

Code -

$SessionToken = "session token of account with admin access"
$Server = "https://myarcherserver"
$Uri = "contentapi"
$Headers = @{"accept" = "application/json"; "content-type" = "application/json"; "Authorization" = ("Archer session-id=`"" + $SessionToken + "`""); "X-Http-Method-Override" = $Method.GET }
$Response = Invoke-RestMethod -Method $Method.POST -Headers $Headers -Uri ($Server+$Uri) -body (convertto-json $Body)
$Response

 

 

Error I am getting -

 

Invoke-RestMethod :
401 - Unauthorized: Access is denied due to invalid credentials.
Server Error

401 - Unauthorized: Access is denied due to invalid credentials.
You do not have permission to view this directory or page using the credentials that you supplied.

11 REPLIES 11

Yes, it should be set as anonymous only, not Windows, nor basic, nor any other.

Well, you need to find out what has changed in web.config or other settings before it stopped to work