Fisheye/Crucible REST API giving 401 error while adding git repository

Hi Team,

I am trying to add git repository using Fisheye/Crucible REST API. I tried providing username and passowrd with basic authentication and also tried with bearer token. But in both ways, it is giving 401 (client must be authenticated to access resource) error. I am using powershell script to call REST API. Below is my code:

function New-FisheyeRepo {
Used add a new AWS CodeCommit repo to Fisheye.
Used add a new AWS CodeCommit repo to Fisheye.
DK 5/30/2018
[parameter(Mandatory=$True,ValueFromPipeline=$True)][string] $branchname,
[parameter(Mandatory=$True,ValueFromPipeline=$True)][string] $fisheyehost,
[parameter(Mandatory=$False,ValueFromPipeline=$True)][string] $URI=“

$CCRepoToAdd = ""

$authobject= New-Object PSObject -Property @{
    username = $(Convert-FromBase64("YnVpbGQ="))
    password= $(Convert-FromBase64("QnUxbGRlcjI="))

#$basicAuth= ("Basic " + [string](Convert-ToBase64("YnVpbGQ=" + ":" + "QnUxbGRlcjI=")))
$tokenAuth = "Bearer 352c5b6a5bc9b3680ade28374d40ed6c61adf7f2"
$headers = @{
        "Authorization" = $tokenAuth

$postbody = New-object PSObject -Property @{
      type = "git"
      name = "asi"
      url = $CCRepoToAdd
      username = "devops-at-172601357080"
      password = "E3qKv5vBSU1CWaUsScJ8yXN2skzvJesQT9RPuzwoJn4="
      branches = {
          name = $branchname

$jsonpostbody=ConvertTo-Json $postbody

write-debug "Sending creation request $jsonpostbody to $URI"

#$result= Invoke-JIRARequest -URI $URI -method POST -body $jsonpostbody
$result = @(Invoke-RestMethod -Uri $URI -Method POST -Headers $headers -Body $jsonpostbody -ErrorVariable RestError -ErrorAction SilentlyContinue)

#return result

if ($ {
    $startresult= Invoke-JIRARequest -URI $repoURI -method PUT
    if ($startresult) {
        write-verbose "Repo $branchname started (call was to $repoURI)"

Any help in resolving this error would be of great help