The sw operator not working for filtering in user API

Hi,

Our company just bought Okta and we are trying to do some development on it. I am trying to use filter in user API to search for users with specified user name like this: https://{subdomain}/api/v1/users?filter=profile.login sw “cjin”, but I got a “Bad Request” response with message like this: “errorCode”: “E0000031”, “errorSummary”: “Invalid search criteria.” When I tried to use eq it works well.

Can anyone help? I found a post last year with same issue OKTA API users filter by profile.login - #2 by andrea but there was no answer or solution in that thread.

Thanks!

Chen

If you use search instead of filter, does it work?

It does not. I used the sample search from the API document like this: https://{account}.oktapreview.com/api/v1/users?search=profile.lastName eq “Jin”

Reponses is HTTP 400 (Bad Request) with body below:
{

"errorCode": "E0000031",

"errorSummary": "Invalid search criteria.",

"errorLink": "E0000031",

"errorId": "oae_89ZrSquREqas6RXRzp5jw",

"errorCauses": [

    {

        "errorSummary": "Invalid search syntax."

    }

]

}

That doesn’t make sense to me, this works fine in my own tests.

Can you make sure you don’t have any smart quotes or other invalid characters? Here’s a request URL that’s working fine for me: {{url}}/api/v1/users?search=profile.firstName sw "Jo"

wow cool! I replaced the double quote and it worked for search! that’s interesting. But filter still not working for sw. So this is expected, right? Thanks!

Yeah, based on our docs, filter seems to only support eq while search supports additional operators, but I’m looking to get this confirmed and clarified if possible.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.