# PowerIAM.AssignmentApi

All URIs are relative to *http://localhost:9000*

Method | HTTP request | Description
------------- | ------------- | -------------
[**assignRole**](AssignmentApi.md#assignRole) | **POST** /v2/assign-role | 
[**getRoleAssignments**](AssignmentApi.md#getRoleAssignments) | **GET** /v2/get-role-assignments | 
[**unassignRole**](AssignmentApi.md#unassignRole) | **DELETE** /v2/unassign-role | 

<a name="assignRole"></a>
# **assignRole**
> AssignmentV2 assignRole(body)



Assign a role to a user in the world or in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.AssignmentApi();
let body = new PowerIAM.AssignRoleCommandV2(); // AssignRoleCommandV2 | 

apiInstance.assignRole(body, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**AssignRoleCommandV2**](AssignRoleCommandV2.md)|  | 

### Return type

[**AssignmentV2**](AssignmentV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="getRoleAssignments"></a>
# **getRoleAssignments**
> [AssignmentV2] getRoleAssignments(opts)



Get role assignments. For a specific user or all users. In the world or in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.AssignmentApi();
let opts = { 
  'toUserId': "toUserId_example", // String | 
  'inRealmId': "inRealmId_example" // String | 
};
apiInstance.getRoleAssignments(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **toUserId** | **String**|  | [optional] 
 **inRealmId** | **String**|  | [optional] 

### Return type

[**[AssignmentV2]**](AssignmentV2.md)

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="unassignRole"></a>
# **unassignRole**
> &#x27;String&#x27; unassignRole(opts)



Unassign a role from a user in the world or in a realm.

### Example
```javascript
import {PowerIAM} from '@poweriam/sdk';
let defaultClient = PowerIAM.ApiClient.instance;

// Configure API key authorization: JWT Token
let JWT Token = defaultClient.authentications['JWT Token'];
JWT Token.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT Token.apiKeyPrefix = 'Token';

let apiInstance = new PowerIAM.AssignmentApi();
let opts = { 
  'assignmentId': "assignmentId_example" // String | 
};
apiInstance.unassignRole(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **assignmentId** | **String**|  | [optional] 

### Return type

**&#x27;String&#x27;**

### Authorization

[JWT Token](../README.md#JWT Token)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

