addRole
Add a specific role to a specific user
Returns the specified user details
/api/admin/user/{id}/{role}
Usage and SDK Samples
curl -X post -H "x-api-key: [[apiKey]]" -H "Authorization: [[apiKey]]" "http://localhost:8080/sas/v1/api/admin/user/{id}/{role}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.ApiadminApi;
import java.io.File;
import java.util.*;
public class ApiadminApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key");
api_key.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.setApiKeyPrefix("Token");
// Configure API key authorization: bearer
ApiKeyAuth bearer = (ApiKeyAuth) defaultClient.getAuthentication("bearer");
bearer.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.setApiKeyPrefix("Token");
ApiadminApi apiInstance = new ApiadminApi();
String id = id_example; // String | user id
String role = role_example; // String | role to add
try {
apiInstance.addRole(id, role);
} catch (ApiException e) {
System.err.println("Exception when calling ApiadminApi#addRole");
e.printStackTrace();
}
}
}
import io.swagger.client.api.ApiadminApi;
public class ApiadminApiExample {
public static void main(String[] args) {
ApiadminApi apiInstance = new ApiadminApi();
String id = id_example; // String | user id
String role = role_example; // String | role to add
try {
apiInstance.addRole(id, role);
} catch (ApiException e) {
System.err.println("Exception when calling ApiadminApi#addRole");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"x-api-key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"x-api-key"];
// Configure API key authorization: (authentication scheme: bearer)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
String *id = id_example; // user id
String *role = role_example; // role to add
ApiadminApi *apiInstance = [[ApiadminApi alloc] init];
// Add a specific role to a specific user
[apiInstance addRoleWith:id
role:role
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
var SimpleAuthenticationService = require('simple_authentication_service');
var defaultClient = SimpleAuthenticationService.ApiClient.instance;
// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['x-api-key'] = "Token"
// Configure API key authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearer.apiKeyPrefix['Authorization'] = "Token"
var api = new SimpleAuthenticationService.ApiadminApi()
var id = id_example; // {String} user id
var role = role_example; // {String} role to add
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.addRole(id, role, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class addRoleExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("x-api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("x-api-key", "Bearer");
// Configure API key authorization: bearer
Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");
var apiInstance = new ApiadminApi();
var id = id_example; // String | user id
var role = role_example; // String | role to add
try
{
// Add a specific role to a specific user
apiInstance.addRole(id, role);
}
catch (Exception e)
{
Debug.Print("Exception when calling ApiadminApi.addRole: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');
// Configure API key authorization: bearer
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$api_instance = new Swagger\Client\Api\ApiadminApi();
$id = id_example; // String | user id
$role = role_example; // String | role to add
try {
$api_instance->addRole($id, $role);
} catch (Exception $e) {
echo 'Exception when calling ApiadminApi->addRole: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::ApiadminApi;
# Configure API key authorization: api_key
$WWW::SwaggerClient::Configuration::api_key->{'x-api-key'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-api-key'} = "Bearer";
# Configure API key authorization: bearer
$WWW::SwaggerClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";
my $api_instance = WWW::SwaggerClient::ApiadminApi->new();
my $id = id_example; # String | user id
my $role = role_example; # String | role to add
eval {
$api_instance->addRole(id => $id, role => $role);
};
if ($@) {
warn "Exception when calling ApiadminApi->addRole: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
swagger_client.configuration.api_key['x-api-key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['x-api-key'] = 'Bearer'
# Configure API key authorization: bearer
swagger_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.ApiadminApi()
id = id_example # String | user id
role = role_example # String | role to add
try:
# Add a specific role to a specific user
api_instance.addRole(id, role)
except ApiException as e:
print("Exception when calling ApiadminApi->addRole: %s\n" % e)
Parameters
Name | Description |
---|---|
id* | |
role* |