Method:/user/search


Examples:

Note: in the following examples, you can use any "searchable" attributes in user as the match condition, not only the attributes in the example.

e.g.

["loginName", "=", "john"]

or

["email", "=", "john@acme.com"]


  1. Search users in a domain

    Parameters
    {
        "match":
        [
             [domain.id", "=", "domain id 1"],
             ["lastName", "=", "Smith"]
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }
    Response
    {
        "error":0,
        "result":
        {
            "total": 20,
            "rows":
            [
                {
                    "id":"user id 1", 
                    "loginName":"John Smith",
                    "email": "john.smith@acme.com"
         	    },
                {
                    "id":"user id 2", 
                    "loginName":"Alice Smith",
                    "email": "alice.smith@acme.com"
                }, 
         	    ...
            ]
        }
    }
  2. Search users in a unit

    Parameters
    {
        "match":
        [
             [unit.id", "=", "unit id 1"],
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }
    Response
    {
        "error":0,
        "result":
        {
            "total": 20,
            "rows":
            [
                {
                    "id":"user id 1", 
                    "loginName":"John Smith",
                    "email": "john.smith@acme.com"
         	    },
                {
                    "id":"user id 3", 
                    "loginName":"Bob Smith",
                    "email": "bob.smith@acme.com"
                }, 
         	    ...
            ]
        }
    }
  3. Search users in a group

    Parameters
    {
        "match":
        [
             [group.id", "=", "group id 1"],
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }
    Response
    {
        "error":0,
        "result":
        {
            "total": 20,
            "rows":
            [
                {
                    "id":"user id 1", 
                    "loginName":"John Smith",
                    "email": "john.smith@acme.com"
         	    },
                {
                    "id":"user id 2", 
                    "loginName":"Alice Smith",
                    "email": "alice.smith@acme.com"
                }, 
         	    ...
            ]
        }
    }
  • No labels