Chilkat Online Tools

Powershell / Anypoint Platform APIs / Get current user permissions

Back to Collection Items

Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = New-Object Chilkat.Http

$http.SetRequestHeader("X-ANYPNT-ENV-ID","{{environment_id}}")
# Adds the "Authorization: Bearer {{token}}" header.
$http.AuthToken = "{{token}}"
$http.SetRequestHeader("X-ANYPNT-ORG-ID","{{organization_id}}")

$sbResponseBody = New-Object Chilkat.StringBuilder
$success = $http.QuickGetSb("https://domain.com/cloudhub/api/core-services/users/current/permissions",$sbResponseBody)
if ($success -eq $false) {
    $($http.LastErrorText)
    exit
}

$("Response status code = " + $http.LastStatus)
$($sbResponseBody.GetAsString())

Curl Command

curl -X GET
	-H "Authorization: Bearer {{token}}"
	-H "X-ANYPNT-ORG-ID: {{organization_id}}"
	-H "X-ANYPNT-ENV-ID: {{environment_id}}"
https://domain.com/cloudhub/api/core-services/users/current/permissions

Postman Collection Item JSON

{
  "name": "Get current user permissions",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ORG-ID",
        "value": "{{organization_id}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ENV-ID",
        "value": "{{environment_id}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/cloudhub/api/core-services/users/current/permissions",
      "host": [
        "{{url}}"
      ],
      "path": [
        "cloudhub",
        "api",
        "core-services",
        "users",
        "current",
        "permissions"
      ]
    }
  },
  "response": [
  ]
}