cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1186
Views
0
Helpful
2
Replies

Create Person - Is there a REST API

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.

2 Replies 2

asattark
Cisco Employee
Cisco Employee

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

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);

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: