# get all username

**URL:** <https://community.ofelia.com/t/get-all-username/9510>\
**Category:** Q&A\
**Created:** [12 March 2019 09:06 UTC](https://community.ofelia.com/t/get-all-username/9510 "2019-03-12T09:06:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [12 March 2019 09:06 UTC](https://community.ofelia.com/t/get-all-username/9510/1 "2019-03-12T09:06:11Z")

</div>

how to get all usernames in a single JSON array. Is there any API to get all usernames. Thanks in advance please help me.

---

<div class="post-metadata">

**Author:** ![Jerome.Jargot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/jerome.jargot/32/925_2.png) [@Jerome.Jargot](https://community.ofelia.com/u/Jerome.Jargot)\
**Post date:** [12 March 2019 13:00 UTC](https://community.ofelia.com/t/get-all-username/9510/2 "2019-03-12T13:00:32Z")

</div>

Hello,

There is no API call to retrieve _ **only** _ usernames. Do not hesitate to go to this documentation page&nbsp;[identity API](https://documentation.bonitasoft.com/bonita/7.8/identity-api#toc42).

#### (preferred) Implement a new Custom REST API extension

Bonita enables you to add a new REST API extension. It would provide in the body of a HTTP response the information needed as JSON: I.E. a list of userNames. Please have a look to this documentation page: [REST API extensions](https://documentation.bonitasoft.com/bonita/7.8/api-extensions)

* * *

#### (not preferred) out-of-the-box Solution

The existing `API/identity/user` REST resource, available with a GET HTTP request, enables you to retrieve a JSON, containing detailed information of the users. If a tomcat is running locally on the 8080 port, the URL below can be used to retrieve up to 10000 users:

```
[http://localhost:8080/bonita/API/identity/user?p=0&c=10000](http://localhost:8080/bonita/API/identity/user?p=0&c=10000)
```

###### UID FORM edition example

A UID form’s variable can be used to

- either sends a HTTP request and stores the JSON response: External API,
- or stores the result of the execution of javascript lines of code: javascript expression.

This example shows how to store the usernames of many users in a UID Form’s variable named `allUserNames`.

Click on the Create a new variable button in order to create a variable with name **allUsers** , type **External API** , and value ../API/identity/user?p=0&c=10000

![Create new variable button UID][Create new variable button UID]

Create a second variable with name **allUserNames** , type **Javascript expression** , value

```
var usernames = [];
for (var i=0; i&lt;$data.allUsers.length; i++) {
      usernames.push($data.allUsers[i].userName);
}
return usernames;
```

![Create a new variable button](https://dub1.discourse-cdn.com/flex013/sites/community.bonitasoft.com/files/blog/javascript_expression_uid.png)

Regards,  
Jerome

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [12 March 2019 16:07 UTC](https://community.ofelia.com/t/get-all-username/9510/3 "2019-03-12T16:07:11Z")

</div>

Hi&nbsp;Jerome,

thanks for reply actually from this we will get all the users from the organizations but I want only archieved&nbsp;usernames only.&nbsp;

For example i have three tasks user1 for step1&nbsp;, user2 for step2 , user3&nbsp;for step3&nbsp; &nbsp;now I want user1&nbsp;in step2&nbsp;and also user1 and user2&nbsp;in step3&nbsp;. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [26 March 2019 11:51 UTC](https://community.ofelia.com/t/get-all-username/9510/4 "2019-03-26T11:51:33Z")

</div>

var getAuditDetailJSON = ;  
getAuditDetailJSON = $data.auditDetails;  
var auditTrail = ;

for(var i= 0;i\<getAuditDetailJSON.length;i++){  
var userId = getAuditDetailJSON[i].executedBy;  
var taskName = getAuditDetailJSON[i].displayName;  
var dateTime = getAuditDetailJSON[i].archivedDate;

```
var user_name = ..API/identity/user/{{userId}}

var x = {user_name,userId,taskName,dateTime};   
auditTrail.push(x);

```

}

return auditTrail;

please look into the above code which i created in javascxcript variable in ui designer i am displaying userId,taskName,date and userName, for username i am using **var user\_name = …API/identity/user/{{userId}}** but i am not geetting username from this it is showing syntax error. Please help me is ther any other way to achieve this. Thanks in advance.  
\*\*

---

<div class="post-metadata">

**Author:** ![Jerome.Jargot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/jerome.jargot/32/925_2.png) [@Jerome.Jargot](https://community.ofelia.com/u/Jerome.Jargot)\
**Post date:** [8 April 2019 09:07 UTC](https://community.ofelia.com/t/get-all-username/9510/5 "2019-04-08T09:07:30Z")

</div>

@ramireddy.pingala: The answer had been edited to clarify, I hope. To send HTTP requests, you need to use either javascript function either UID variables.

---

<div class="post-metadata">

**Author:** ![Jerome.Jargot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/jerome.jargot/32/925_2.png) [@Jerome.Jargot](https://community.ofelia.com/u/Jerome.Jargot)\
**Post date:** [8 April 2019 09:18 UTC](https://community.ofelia.com/t/get-all-username/9510/6 "2019-04-08T09:18:56Z")

</div>

@ramireddy.pingala: The answer had been edited to clarify, I hope. To send HTTP requests, you need to use either javascript function (XMLHttpRequest) either a UID variable with type External API.

---

<div class="post-metadata">

**Author:** ![ramireddy.pingala](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@ramireddy.pingala](https://community.ofelia.com/u/ramireddy.pingala)\
**Post date:** [21 May 2019 12:45 UTC](https://community.ofelia.com/t/get-all-username/9510/7 "2019-05-21T12:45:45Z")

</div>

Hi,  
Still I didn’t get any solution for this isssue, I solved this issue by saving the details into the database and retriveing through webService. I solved this problem like this.  
Thank you
