Loading

How to Get Users and Roles List With the Access Management API

Дата публикации: Mar 2, 2024
Задача

GOAL

Get Anypoint Platform Users information including Roles and RoleGroups using the Access Management API.
Действия
  1. Refer to the Knowledge Article How to get CloudHub application information using Anypoint Platform API and get an Access Token (using an Organization Admin user) and the Organization ID.
  2. Use the below call to get the Users information: 
    curl "https://anypoint.mulesoft.com/accounts/api/organizations/<OrganizationID>/users?limit=100&offset=0" \
    -H "authorization: bearer <AccessToken>"
    Note: If the query parameter of limit=100 is not provided, then the response would be default to 25 users. The response will include up to 100 users (as per the set limit) and will look like:
    {
      "data": [
        {
          "id": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
          "username": "userSample",
          "firstName": "user",
          "lastName": "sample",
          "email": "user.sample@example.com",
          "organizationId": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
          "enabled": true,
          "idprovider_id": "example",
          "createdAt": "2020-01-01T00:00:00.000Z",
          "updatedAt": "2020-01-01T00:00:00.000Z",
          "lastLogin": "2020-01-01T00:00:00.000Z",
          "mfaVerifiersConfigured": false,
          "mfaVerificationExcluded": false,
          "type": "host",
          "organization": {
            "name": "Example",
            "id": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
            "createdAt": "2020-01-01T00:00:00.000Z",
            "updatedAt": "2020-01-01T00:00:00.000Z",
            "ownerId": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
            "clientId": "a1234b567c89012d3e4fg56hi78jk901",
            "idprovider_id": "example",
            "isFederated": false,
            "parentOrganizationIds": [],
            "subOrganizationIds": [
              "a1234b56-7c89-012d-3e4f-g56hi78jk901",
              "a1234b56-7c89-012d-3e4f-g56hi78jk901"
            ],
            "tenantOrganizationIds": [],
            "mfaRequired": "no",
            "domain": "example-usample",
            "isMaster": true,
            "subscription": {
              "category": "Trial",
              "type": "Product",
              "expiration": "3020-01-01T00:00:00.000Z"
            },
            "properties": {},
            "entitlements": {
              ...
              <entitlements here>
              ...
            }
          }
        },
      ],
      "total": 1
    }
  3. Use the id parameter from the response to get the Roles and RoleGroups. In the above sample, the id is a1234b56-7c89-012d-3e4f-g56hi78jk901.
  4. curl "https://anypoint.mulesoft.com/accounts/api/organizations/<OrganizationID>/users/<UserID>/roles?limit=100&offset=0" \
    -H "authorization: bearer <AccessToken>"
    
    and
    
    curl "https://anypoint.mulesoft.com/accounts/api/organizations/<OrganizationID>/users/<UserID>/rolegroups?limit=100&offset=0" \
    -H "authorization: bearer <AccessToken>"
    The response will include up to 100 roles and rolegroups (as per the set limit) and will respectively look like: 
    {
      "data": [
        {
          "role_id": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
          "context_params": {
            "org": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
            "product": "exchange",
            "projectId": "a1234b56-7c89-012d-3e4f-g56hi78jk901"
          },
          "name": "Role Name",
          "description": "Role Description"
        }
      ],
      "total": 1
    }
    
    and
    
    {
      "data": [
        {
          "role_group_id": "a1234b56-7c89-012d-3e4f-g56hi78jk901",
          "name": "Role Name",
          "description": "Role Description",
          "context_params": {},
          "user_role_group_id": "a1234b56-7c89-012d-3e4f-g56hi78jk901"
        }
      ],
      "total": 1
    }
    
Номер статьи базы знаний

001115942

 
Загрузка
Salesforce Help | Article