Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API for "/admin" functions with Powershell

Steven Mustari
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 10, 2020

I'm experimenting with using the API to configure a test server that is refreshed weekly and am running into difficulty with a couple different functions. The entire copy from production and re-licensing of the server, along with some initial configurations is contained in a couple powershell scripts.

I've had good success with most API interaction, however it seems whenever I try to run an admin function I end with a successful GET, that does not produce the desired result. However, when I run this from a web browser API tester (Talend) the call is successful.

This is one part of the script I am struggling with:

$resetLnF = "https://%BASEURL%/rest/api/2.0/secure/admin/LookAndFeel!resetLogo.jspa"

Invoke-RestMethod -uri $resetLnF -Headers $jsonHeaders -Method GET -ContentType "application/json"

When I run this from poweshell.. I get a return that it's looking for additional authentication to perform the action even though credentials are already being passed. (The request doesn't fail, so it's authenticating to return the data it's returning)

When I run the same call from a web browser API tester, I get a message indicating that Chrome doesn't support a redirect body, however the request appears to perform the function, if I check the test server, the Look and Feel has been reset.

Is this because the token required proceed is already in the browser so the request is successful? If so is there anyway in powershell to bypass this, or pass that information to proceed in the request?

Any help would be appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.1
TAGS
AUG Leaders

Atlassian Community Events