Problem with /api/V3/Projection/GetProjectionByCriteria

Stuart_EddyStuart_Eddy Customer IT Monkey ✭
When I run the following code in PowerShell

$credentials = @{
    UserName='xxxxxx'
    Password='xxxxxx'
    LanguageCode='ENU'
}
$jsonCredentials = $credentials | ConvertTo-Json
#first retrieve your access token
$url = $site+"/api/V3/Authorization/GetToken"
$apiKey = try { Invoke-RestMethod $url -Method POST -Body $jsonCredentials -ContentType 'application/json' } catch { $_.Exception.Response }
$body = '{
  "Id": "0e1313ab-dc5c-cf9d-d6b0-e2e9835a132a",
  "Criteria": {
    "Base": {
      "Expression": {
        "SimpleExpression": {
          "ValueExpressionLeft": {
            "GenericProperty": "DisplayName"
          },
          "Operator": "Like",
          "ValueExpressionRight": {
            "Value": "%Stuart%"
          }
        }
      }
    }
  }
}'

$authVal = "Token " + $apiKey
$jsonBody = $body | ConvertTo-Json
$standardBody = $jsonBody | ConvertFrom-Json
$url = $site + "/api/V3/Projection/GetProjectionByCriteria"
$response = try { Invoke-RestMethod $url -Method Post -Body $body -ContentType 'application/json' -Headers @{"AUTHORIZATION"=$authVal} } catch { $_.Exception.Response }


I get the error :
Microsoft.EnterpriseManagement.Common.UnauthorizedAccessEnterpriseManagementException: Unable to execute command, user connection not found. at Cireson.ServiceManager.ManagementService.ManagementServiceConnectionPool.GetCachedConne ction(String userName) at Cireson.ServiceManager.ManagementService.ManagementService.InvokeCommand[T](Func`2 func , Boolean invokeAsService) at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Tas k task) at Cireson.ServiceManager.ManagementService.ManagementService.<InvokeCommandAsync>d__9`1.M oveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Tas k task) at Cireson.ServiceManager.Services.Projection.<GetProjectionByCriteriaAsync>d__11.MoveNext ()

as far as I am aware the user does have access to the section and I get a token,  any idea of where I can look to help resolve this issue?

Answers

  • Tony_CollettTony_Collett Cireson Support Super IT Monkey ✭✭✭✭✭
    Hi Stuart, 

    Which version of the portal are you using?
Sign In or Register to comment.