User Roles
Manage User Roles
get
https://<domain>/<api prefix>/<version>/user/get/roles/
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/user/get/roles/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access-token>',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<domain>/<api prefix>/<version>/user/get/roles/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"apikey: <apikey>",
"Authorization: Bearer <access-token>",
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
https://<domain>/<api prefix>/<version>/upgrade/user-role/
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/upgrade/user-role/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access-token>'
},
formData: {
'unique_id': '<user_unique_id>',
'upgrade_to': '<upgrade_option>',
'api_place_genealogy': '<True_or_False>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/upgrade/user-role/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('unique_id' => '<user_unique_id>','upgrade_to' => '<upgrade_option>','api_place_genealogy' => '<True_or_False>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access-token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Status Code | Error Type | Field | Description |
400 | Validation Error | unique_id | This field is required and its may not be blank. User not exist or invalid unique id. Ensure this field has no more than 255 characters. |
400 | Validation Error | upgrade_to | This field is required and its may not be blank. Invalid upgrade option, Choose a valid one. |
400 | Validation Erorr | api_place_genealogy | This field is required and its may not be blank. Choose a valid option. |
403 | Request Failed | | User role is already upgraded. User already have a member role. User already have a preferred customer role. Free user place genealogy disabled, can't upgrade user role. Free package for user role upgrade is not created. User role upgrade option not found. Created free package is not a customer privilaged package. Created free package is not a member privilaged package. |
post
https://<domain>/<api prefix>/<version>/downgrade/user-role/
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/downgrade/user-role/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access-token>'
},
formData: {
'unique_id': '<user_unique_id>',
'downgrade_to': '<downgrade_option>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/downgrade/user-role/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('unique_id' => '<user_unique_id>','downgrade_to' => '<downgrade_option>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access-token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Error Responses
Status Code | Error Type | Field | Description |
400 | Validation Error | unique_id | This field is required and its may not be blank. User not exist or invalid unique id. Ensure this field has no more than 255 characters. |
400 | Validation Error | downgrade_to | This field is required and its may not be blank. Invalid downgrade option, Choose a valid one. |
400 | Validation Erorr | api_block_user | Choose a valid option. |
403 | Request Failed | | User already have a downgraded role. User already have a customer role. User already have a preferred customer role. Somthing went wrong. |
Last modified 1yr ago