Closed againt77 closed 4 years ago
@againt77, Thanks for your inquiry and sorry for the inconvenience. I am inquiring internally and I will reply back here when I have additional information to share.
@againt77,
I'm advised that the groups endpoint does still support the expand
parameter and it appears to have been removed because it is not documented. I will add to our team backlog an item to add this parameter back in. In the mean time you can use code similar to the following to make an api call with the expand
parameter included.
var groupList = await _oktaClient.GetCollection<IGroup>(new HttpRequest
{
Uri = "/api/v1/groups",
Verb = HttpVerb.Get,
QueryParameters = new Dictionary<string, object>()
{
["expand"] = "stats",
},
}).ToArrayAsync();
I hope this helps, let me know if I have misinterpreted your question. Thanks!
Thank you for fast reply. As temporary solution will use Your example. But hope expand parameter will be back. Yes it's not documented, but is in the Okta KB
The expand
property has been added back in https://github.com/okta/okta-sdk-dotnet/releases/tag/v3.2.1. Thanks for your feedback @againt77 ⭐
Hi. After switching from 2.x to 3.x SDK version I missing expand attribute: ListGroups(string q, string filter, string after, int limit, string expand) — Signature changed ListGroups(string q, string filter, string after, int limit) But it was very useful for groups to get Users Count in one request. Postman example
"_embedded": { "stats": { "usersCount": 6, "appsCount": 1, "groupPushMappingsCount": 0, "hasAdminPrivilege": false, "_links": { "self": { "href": "" } } }
C# Code example
var oktaGroups = _oktaClient.Groups.ListGroups(null,null,null,-1,"\"stats\"").Select(x => { if (x.LastMembershipUpdated == null) return null; if (x.LastUpdated != null) return new OktaGroupTemp { OktaID = x.Id, Name = x.Profile.Name, Description = x.Profile.Description, Type = x.Type, LastMembershipUpdatedAt = x.LastMembershipUpdated.Value.DateTime, LastUpdatedAt = x.LastUpdated.Value.DateTime, UserCount = JsonConvert.DeserializeObject<OktaGroupStats>(JsonConvert. / SerializeObject(x.GetData().FirstOrDefault(k => k.Key.Equals("_embedded")).Value)).Stats?.UsersCount ?? 0 }; return null; }).ToListAsync().Result;
Is it possible to return this possibility?