I have followed up OAuth to successfully make a request by following the sample java source code with OAuth Access Token, but I am not able to make a request via PowerShell with OAuth Access Token, can somebody help me? thanks in advance.
Below is the PowerShell script I used, there is no error occurs but the result is null.
$accessToken = “xxxxxxxxxxxxx”
$headers = @{Authorization = “Bearer $accessToken”}
$restapiuri = “https://jira-test/rest/api/2/project”
Invoke-RestMethod -uri $restapiuri -Headers $headers -Method GET -ContentType ‘application/json’ -Verbose
Output from PowerShell:
VERBOSE: GET xxxx//jira-test/rest/api/2/project with 0-byte payload
VERBOSE: received -byte response of content type application/json
VERBOSE: Content encoding: utf-8