Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
_/user/search
_/user/search
Anchor
_Toc341972409
_Toc341972409
/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

    Code Block
    languagejs
    titleParameters
    {
        "match":
        [
             [domain.id", "=", "domain id 1"],
             ["lastName", "=", "Smith"]
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }


    Code Block
    languagejs
    titleResponse
    {
        "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

    Code Block
    languagejs
    titleParameters
    {
        "match":
        [
             [unit.id", "=", "unit id 1"],
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }


    Code Block
    languagejs
    titleResponse
    {
        "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

    Code Block
    languagejs
    titleParameters
    {
        "match":
        [
             [group.id", "=", "group id 1"],
        ],
        "return":["id", "loginName", "email"],
        "sort":"loginName",
        "order":"asc",
        "max": 20,
        "offset": 0
    }


    Code Block
    languagejs
    titleResponse
    {
        "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"
                }, 
         	    ...
            ]
        }
    }


...

Code Block
languagejs
titleParameters
{
    "match":
    [
         [domain.id", "=", "domain id 1"],
         [id", "=", "user id 1"] // or ["loginName", "=", "john"] etc, any searchable user attributes can be used as the match condition
    ],
    "return":["id", "loginName", "email"]
}

...