Solved

What do I put in "filters" when using the GET or POST search users command?

  • 8 November 2023
  • 2 replies
  • 71 views

I am trying to use the get command here: https://developers.ringcentral.com/api-reference/SCIM/scimSearchViaGet2


And it allows a filter "Only support 'userName' or 'email' filter expressions for now" but I'm not sure how to format it because I keep getting a 400 error:


{

"schemas": [

"urn:ietf:params:scim:api:messages:2.0:Error"

],

"status": "400",

"scimType": "invalidFilter",

"detail": "Only 'userName' or 'emails' fields and operation 'eq' are supported"

}

How do I enter the filter for an email address? I've tried email:person@company.com or userName:person@wellthy.com and still having issues.

icon

Best answer by Phong1426275020 9 November 2023, 00:41

View original

2 replies

Userlevel 1

Check out the search syntax from here. We don't support all operators though.

Here is an example to search by email address:

async function search_user() {
    var params = {
          //filter: 'userName co "john.smith@live.com"'
          //filter: 'phoneNumbers [type eq "work" and value eq "12341234567"
          filter: 'emails [type eq "work" and value eq "firstname.lastname@gmail.com"]'
    }
    try {
      var resp = await platform.get('https://platform.ringcentral.com/scim/v2/Users', param
      var jsonObj = await resp.json()
      for (var res of jsonObj.Resources)
        console.log(res)
    }catch(e){
        console.log(e)
    }
}

Great, that worked. Just fyi, the expression in the reference says "email" but that didn't work, I had to put emails:


/users/?filter=emails eq "test@company.com"

Reply