<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00009GYuOfCALOkta Identity EngineAPI Access ManagementAnswered2023-06-08T14:31:03.000Z2023-06-07T12:51:33.000Z2023-06-08T14:31:03.000Z

BillS.23320 (Customer) asked a question.

User Api search error on "not equals" (ne) but is fine with equals (eq)

I have no issues with this search:

https://my.okta.com/api/v1/users?search=profile.login eq "test@test.com" and profile.lastName eq "smith"

but I get "Invalid search syntax." when I try to do a not equal on the lastname.

https://my.okta.com/api/v1/users?search=profile.login eq "test@test.com" and profile.lastName ne "smith"

 

According to this:

https://support.okta.com/help/s/article/What-Operators-are-Supported-by-Okta-Rest-API?language=en_US

ne is a supported operation.

 

am I missing something here?

 

Thank you.


  • DonF.81354 (Customer)

    Hi! Yes - this one is tricky. Please reference this doc: Core Okta API - Operators

     

    Here the following is stated: Note: The ne (not equal) operator isn't supported for some objects, but you can obtain the same result by using "lt ... or ... gt". For example, to see all user agents except for "iOS", use (client.userAgent.os lt "iOS" or client.userAgent.os gt "iOS").

     

    So in your example, try out the following:

     

    https://my.okta.com/api/v1/users?search=profile.login eq "test@test.com" and (profile.lastName lt "smith" or profile.lastName gt "smith")

     

    In my own testing, this both worked and gave me the expected result. Thanks!

    Expand Post
    Selected as Best
  • DonF.81354 (Customer)

    Hi! Yes - this one is tricky. Please reference this doc: Core Okta API - Operators

     

    Here the following is stated: Note: The ne (not equal) operator isn't supported for some objects, but you can obtain the same result by using "lt ... or ... gt". For example, to see all user agents except for "iOS", use (client.userAgent.os lt "iOS" or client.userAgent.os gt "iOS").

     

    So in your example, try out the following:

     

    https://my.okta.com/api/v1/users?search=profile.login eq "test@test.com" and (profile.lastName lt "smith" or profile.lastName gt "smith")

     

    In my own testing, this both worked and gave me the expected result. Thanks!

    Expand Post
    Selected as Best
This question is closed.
Loading
User Api search error on "not equals" (ne) but is fine with equals (eq)