05-15-2018 03:06 PM - last edited on 03-25-2019 11:12 PM by ciscomoderator
I am required to create a new Person in PSC (Organizational Designer) and assign a Custom Role (already created).
When I used the API to get all roles, I am not receiving any custom created Roles in PSC. Your prompt help here will get me out of a situation.
05-21-2018 12:22 AM
Hi Raj,
I'm assuming that you are using the following API: http://<Server>/RequestCenter/nsapi/directory/roles?recordSize=15&startRow=1 .
This API should return all the Roles that, the logged in user has a Read permission on. By default the API returns only 20 roles if no parameters are sent for pagination.
Can you please check if the user has Read permission on the Role that you want to assign and also the required query parameters for pagination are supplied.
Thanks,
Aziz
06-24-2018 09:45 AM
Hi Aziz,
Thank you. I have been to overcome the issue as per your suggestion. The second step for me after creating a Person in PSC is to assign a role. For Userlogin 'testrajadmin', using the nsapis with the following returns a http 500 error responses:
var data = JSON.stringify({
"rolemapping": {
"operation": "assign",
"roles": [
"Name",
"Tenant Administrator"
]
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://172.16.174.19:8080/RequestCenter/nsapi/directory/people/testrajadmin/roles");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("authorization", "Basic YWRtaW46T25zdGFrMTIz");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "e59fc619-19e2-95dd-129c-f858027fce76");
xhr.send(data);
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide