Does okta support user resolving? - okta

I am testing OKTA api-users, and I’m interested about a specific capability that I couldn’t find. I want to be able to attach to the request 100 id’s and get back an array of the user objects of these id’s(just like api/v1/users/{id} API,but for many ids), Is there an API of OKTA that can do it(maybe some post request that receives in body the ids and returns the user objects?) ?
I was able to make a workaround, by using the GET api/v1/users API with query parameters(filter/search) but I didn’t find it to be the best solution because the URL can’t be too long(I had to put 100 ids to the search parameter).
Thanks

The closest thing would be to use a search or filter param:
https://developer.okta.com/docs/reference/api/users/#list-users-with-a-filter
/api/v1/users?filter=id eq "id1" or id eq "id2"
Which for 100 params would be too long, as you noticed.
In true StackOverflow fashion, don't do A, do B. (sorry). You have a few options, but it depends on what you are doing.
If you are always querying the same set of users, you could add a custom attribute to your set of users:
/api/v1/users?search=profile.favOneHundred eq "true"
The other options are use case-specific, can you let us know what you are trying to do with those 100 users, and maybe we offer up an alternative?

Related

Filter Microsoft Graph List Messages API to only received messages

Goal: I'd like to be able to filter the "List Messages" API to only return emails that are sent to the user rather than any messages that exist anywhere (such as ones sent out by the user).
Right now, if you query this particular API, you get a list of all of the messages in all folders (including Deleted Items and Clutter folders).
I know that I can filter on isDraft eq false to remove the drafts - but I don't know if there's any filter to say don't include messages sent by the user.
What I've Tried: I've looked over the examples and didn't see anything about filtering like this. I've also taken a look at the OData Query Params and dug into the filter param. The problem is I'm not quite sure what I could even filter on. I do see that there is a sender parameter - but given I've connected via OAuth and haven't asked users to provide their email address I'm not sure I have an easy way to filter on that.
Theoretically, I could first do a request to the https://graph.microsoft.com/beta/me/ endpoint to get the userPrincipalName and then add a filter on from/emailAddress/address ne '<userPrincipalName>' when I call the /me/messages endpoint - but that's going to double the number of API calls I'd need to make. Is that the only option I have or is there a better way to go about this?
Thanks for your time :)
There is no filter parameter that will achieve this directly. If you want to filter away sent messages - you'll need to either decode the base64 encoded JWT access token and extract the userPrincipalName or make a call to the /me endpoint and retrieve the userPrincipalName from that. Once you have that, you can add a filter of from/emailAddress/address ne '<userPrincipalName>'.
Please note that if you are filtering on many things and you have an "order by" param that you'll need to include that param in your filter or you'll receive an error about too many filters.

What would be an API end point to retrieve all customer's review of a product and all reviews of a specific customer

My line o thinking is this:
get evaluations //would retrieve all evaluations of the system. (in practice never used).
post evaluations create a new evaluation
Following the Rest pattern
get evaluations/1 //details of the evaluation with id "1"
But I was using
get evaluation/{product_id}
To retrieve all evaluations of a product.
For what I know of Rest design this is not good. It would be something like this:
evaluations?product_id=5
Now, what it would be an endpoint to retrieve all reviews of a specific client? I am using Auth 2.0.
I am really confused.
Is it possible to shove it all in one controller?
In summary, I would like to know if the endpoint evaluations?product_id=9 is suitable to retrieve all evaluations of a product. And what would be and endpoint to retrieve all evaluations of a client that has a token.
You have many approachs here:
Separate Endpoints:
Suche as:
get /users/{user_id}/evaluations
get /products/{product_ID}/evaluations
get /evaluations/{evaluation_id}
single endpoint
get /evaluations/{type}/{id}
And in your controller implement a logic to retrieve evaluations according to the type (user, product,...) and the id of the selected type.
Personally, I prefer the first one.

How can I retrieve list members using given a unique_email_id on Mailchimp API v3?

Given a unique_email_id, how can I retrieve all list members matching that ID?
I am attempting to use the search-members endpoint, ala what I do for searching email-addresses:
https://us9.api.mailchimp.com/3.0/search-members?query=chris#chris.com
but instead (given a unique_email_id of 4dce5
https://us9.api.mailchimp.com/3.0/search-members?query=4dce5
and I'm getting no results.
Is there another endpoint I'm missing?
However using the query string ?unique_email_id=X attached to the end
of GET lists/list_id/members will pull up anyone with that specific
EUID.
Indeed this works very well. Example :
GET /3.0/lists/dfc3cf4b38/members?unique_email_id=f4b75a9d78&fields=members.email_address
will return :
{"members":[{"email_address":"my_email#hotmail.com"}]}
I've had a chat with the mailchimp support about this issue. This was there response (part of it because not everything discussed in that chat is relevant to this question):
(09:00:04 AM) Mailchimp support: Thanks for hanging in there, Me. It looks like
the email_unique_id can't be searched via API endpoint like it can be
within the app. Another option to get to your goal is GET to
lists/list_id/members with the query string
?fields=members.email_address,members.unique_email_id which should
pull up all their subscribers' emails and unique ids. At that point,
you can filter through those results for the unique id
(09:00:52 AM) Me: Same goes for the user ID I guess?
(09:02:05 AM) Me: Why can't it be searched? When I list ids as well I might miss information. I don't need the unique_email_id in my response, I need to search for it to retrieve user information without getting duplicates in my result
(09:07:11 AM) Mailchimp support: Ok I understand, one
moment while we test this out for you. Thanks again for your patience!
(09:16:22 AM) Mailchimp support: Hey Me, thanks for waiting. I tested the
endpoint lists/list_id/members?unique_email_id=e8da8fa60a and  I was
able to return just the one subscriber with that field. Search-Members
only functions the way it does in app where you can only search
specific strings like names, email addresses, but not ids as those
aren't visible in app. However using the query string
?unique_email_id=X attached to the end of GET lists/list_id/members
will pull up anyone with that specific EUID.

Okta API returning an incomplete list of users and applications

I'm trying to fetch a list of all applications on Okta, and a list of the users using each application.
However, sending a GET request to /api/v1/apps is resulting in an incomplete list of applications, and following a link to the users of each app is also incomplete.
Am I calling incorrectly? Or is there some reason that specific apps/users would not show up in the list?
Any help is appreciated.
EDIT: I am setting limit=10000 and still am missing users.
When a response exceeds the the maximum number of results, the results are paginated and a Link header is added to the results.
For example:
HTTP/1.1 200 OK
Link: <https://yoursubdomain.okta.com/api/v1/users?after=00ubfjQEMYBLRUWIEDKK>; rel="next" <https://yoursubdomain.okta.com/api/v1/users?after=00ub4tTFYKXCCZJSGFKM>; rel="self"
Note: It is important to follow these Link header values instead of constructing your own URLs as query parameters or cursor formats may change without notice.
See the Okta documentation for pagination for more information.
I use the limit and after parameter. Here is an example (in my code I increment my counter by the limit value)
{{url}}/api/v1/users?search=status eq "ACTIVE"and lastUpdated gt "2017-04-26T04:00:00.000Z" and created lt "2017-04-26T04:00:00.000Z" &limit=200&after=1400
This query will return any users that meet the criteria and are after 1400. In other words if I have 1500 users it will return the users 1401 to 1500.

Using the Okta API and .Net SDK

I'm working with the Okta API and trying to understand a couple of things:
How do you get a count of members. For example, how do I get a count of groups defined, or the count of users assigned to a group. The admin tool seems to do this easily enough, but I need to do this in another tool I'm working on.
I can iterate through the pages until I get to the last page, incrementing a counter as I go along, but this is very slow, especially when trying to get the number of groups defined for my subdomain, or other similarly high-numbered value.
How do filters and filterbuilders work? The basics are pretty simple, but the filter syntax doesn't seem to be defined anywhere.
Thanks!
AFAIK the only way to get a count is by getting all users/groups and subsequently the count. There is no API call to get a summary. Basic, but works.
Check the Okta API docs at http://developer.okta.com/docs/api/resources/users.html#user-model for the user model. You will get a collection of those JSON objects when you list the users - http://developer.okta.com/docs/api/resources/users.html#list-users
Call this last API and count the instances that you get back in the JSON collection.

Resources