pingu
July 21, 2023, 8:33pm
1
Is there a way to get the number of users in a group through the sdk?
I can see a way through API, Okta Help Center (Lightning) .
erik
July 21, 2023, 9:51pm
2
Hello,
Most of the Management SDK allow you to include query params for the API endpoints. For example,
resp, err := m.client.requestExecutor.Do(ctx, req, nil)
if err != nil {
return resp, err
}
return resp, nil
}
// Enumerates groups in your organization with pagination. A subset of groups can be returned that match a supported filter expression or query.
func (m *GroupResource) ListGroups(ctx context.Context, qp *query.Params) ([]*Group, *Response, error) {
url := fmt.Sprintf("/api/v1/groups")
if qp != nil {
url = url + qp.String()
}
rq := m.client.CloneRequestExecutor()
req, err := rq.WithAccept("application/json").WithContentType("application/json").NewRequest("GET", url, nil)
if err != nil {
return nil, nil, err
import (
"net/url"
"strconv"
)
type Params struct {
Q string `json:"q,omitempty"`
After string `json:"after,omitempty"`
Limit int64 `json:"limit,omitempty"`
Filter string `json:"filter,omitempty"`
Expand string `json:"expand,omitempty"`
IncludeNonDeleted *bool `json:"includeNonDeleted,omitempty"`
Activate *bool `json:"activate,omitempty"`
ValidityYears int64 `json:"validityYears,omitempty"`
TargetAid string `json:"targetAid,omitempty"`
Kid string `json:"kid,omitempty"`
QueryScope string `json:"query_scope,omitempty"`
SendEmail *bool `json:"sendEmail,omitempty"`
Cursor string `json:"cursor,omitempty"`
Mode string `json:"mode,omitempty"`
Search string `json:"search,omitempty"`
Which SDK were you inquiring about?
Thank You,
pingu
July 21, 2023, 10:43pm
3
I was trying to find the number of users in a group when I look for it with the group ID. Something like client.getGroup('abcde')
This gives me information about the group. I was wondering if there is a way I can get just the size without having to get the users and then check the size.
pingu
July 24, 2023, 5:34pm
5
Found it: Okta API wrapper for Node.js Index
Call other API Endpoints
1 Like
system
Closed
July 25, 2023, 5:34pm
6
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.