# Seaching from among users assigned to an app

**URL:** <https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436>\
**Category:** Help Hub\
**Created:** [June 2, 2021, 7:09pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436 "2021-06-02T19:09:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbogdan](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbogdan](https://community.postman.com/u/jbogdan)\
**Post date:** [June 2, 2021, 7:09pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/1 "2021-06-02T19:09:12Z")

</div>

Pulling the appId from AD-sourced integration ( I am querying Okta), I am trying to search within that collection of users (i.e., those assigned to that particular app) for a particular user with a specific last name. In other words, I want to return all users whose last name is Stone that is part of the appId I have set in my global variable. Here is the query I have developed,

{{url}}/api/v1/apps/{{appId}}/users?search=profile.lastName eq “Stone”

The problem is that it retrieves users who have “Stone” in the managerDn. I don’t want this, I want only users whose last name is “Stone”. How do I revise my query to accomplish that?

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [June 2, 2021, 11:29pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/2 "2021-06-02T23:29:27Z")

</div>

@jbogdan Welcome to the Community 🥳

I haven’t used Okta APIs before, but I did a little research and you are right. I see the same format in the documentation.

Also I don’t see the key name “managerDn”, it that based on the customization?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/6/86b3037ba268028f0825c442603000b962f3baae.png)

I don’t see any issue in the endpoint of yours.

But can you just try filter option?

```auto
{{url}}/api/v1/apps/{{appId}}/users?filter=profile.lastName eq “Stone”

```

Let’s see how this behaves 😊

---

<div class="post-metadata">

**Author:** ![jbogdan](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbogdan](https://community.postman.com/u/jbogdan)\
**Post date:** [June 3, 2021, 12:14pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/3 "2021-06-03T12:14:32Z")

</div>

> [@bpricilla](#):
>
> `{{url}}/api/v1/apps/{{appId}}/users?filter=profile.lastName eq “Stone”`

It spits out an error,  
“errorCode”: “E0000005”,  
“errorSummary”: “Invalid session”,

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [June 4, 2021, 1:03am UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/4 "2021-06-04T01:03:33Z")

</div>

Oh 🙄 so this invalid session is something to do with the Authentication?

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/6/366aa8b9e16d52806e8f6fa83a50bae335951b20.png)

---

<div class="post-metadata">

**Author:** ![jbogdan](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbogdan](https://community.postman.com/u/jbogdan)\
**Post date:** [June 4, 2021, 12:46pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/5 "2021-06-04T12:46:29Z")

</div>

I don’t think the authentication is invalid. Using the same environment variables, I can query the Okta tenant just fine with other queries. As such, I think the above query is malformed.

---

<div class="post-metadata">

**Author:** ![bpricilla](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/bpricilla/32/6511_2.png) [@bpricilla](https://community.postman.com/u/bpricilla)\
**Post date:** [June 4, 2021, 1:13pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/6 "2021-06-04T13:13:54Z")

</div>

@jbogdan Oops, is that so?

Filter is also a valid option provided in their documentation. So that should work as well. And the endpoint is a bit different here, so I believe you have some customizations for internal usage?

Because I tried to import the OKTA collections into my workspace and I see the below for search operation.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/b/8bbe54239edc707ef1ed50872ced38ecda202d25.png)

So there’s no issue with the resource and params. Just confirm the endpoint URL once. May be we connect through call if needed 😊

Any possibility to check with your developers?

This is my [LinkedIn profile](https://www.linkedin.com/in/pricilla-b/) 🙂

---

<div class="post-metadata">

**Author:** ![jbogdan](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbogdan](https://community.postman.com/u/jbogdan)\
**Post date:** [June 4, 2021, 5:27pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/7 "2021-06-04T17:27:43Z")

</div>

What you’re missing is that I am taking the users assigned to an app and then searching among those for a particular last name. Your query searches for all users in an Okta tenant for a particular department.

For example, here is a valid query for all the users assigned to a particular app (if you place the id into the appId environment variable).  
{{url}}/api/v1/apps/{{appId}}/users

I wish to then search from that set of users for one with a matching lastName.

---

<div class="post-metadata">

**Author:** ![jbogdan](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbogdan](https://community.postman.com/u/jbogdan)\
**Post date:** [June 9, 2021, 3:35pm UTC](https://community.postman.com/t/seaching-from-among-users-assigned-to-an-app/24436/8 "2021-06-09T15:35:11Z")

</div>

Does anyone have input on how this can be solved?
