Project

General

Profile

C# and REST api - problem with parameters

Added by Cezary Błajszczak almost 9 years ago

Hi,

I'm having some troubles with parameters in my queries using REST API for C#. I want to find a user by email. I didn't find any direct method to do this, so I used a loop:

User a_user = null;
var params= new NameValueCollection{{"mail", user_to_check.Address}};
foreach (User tmp in manager.GetObjectList<User>(params)) {
    if (tmp.Email.ToLower() == user_to_check.Address.ToLower()) {
        a_user = tmp;
        break;
    }
}

But in my loop I get all users, not the list I want to - filtered by email.

Can someone help? I tried using "mail", "email" and "Email" as my parameter key, but nothing seem to work...