Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Search users using email to check state

    Posted 2 hours ago

    Hello, I am trying to use an API to check if a user currently has a profile (by email) and to check which state it is in (including inactive and deleted). I tried using this API but I am getting some strange results.

    Get /api/v2/scim/users with the filter "email eq ___" but the email that I put in, which I know is linked to a deleted profile, is not coming up. 
    I also tried using the filter "active eq false, email eq ___" but it pulled up a random in-active profile 
    Is there something that I should be doing differently?
    Thanks in advance

    #DataActions
    #PlatformAPI

    ------------------------------
    Connor Maxwell
    -
    ------------------------------


  • 2.  RE: Search users using email to check state

    Posted 2 hours ago

    Hi Connor,

    In this case, one option would be to use the /api/v2/users/search API with the request body below.
    {
      "pageSize": 100,
      "pageNumber": 1,
      "query": [
        {
          "type": "EXACT",
          "fields": [
            "state"
          ],
          "values": [
            "deleted",
            "inactive",
            "active"
          ]
        }
      ],
      "sortOrder": "ASC",
      "sortBy": "name",
      "enforcePermissions": true
    }
     
    In the tests I ran, when the state field is not defined, the API does not return all expected results.


    ------------------------------
    Elisson Fernandes
    ------------------------------



  • 3.  RE: Search users using email to check state
    Best Answer

    Posted an hour ago

    Hello,

    I recommend the same API endpoint that Elisson mentioned - i.e. POST /api/v2/users/search

    Just adding how to filter/search by email address on top of this:

    {
      "sortOrder": "ASC",
      "pageSize": 100,
      "pageNumber": 1,
      "sortBy": "id",
      "query": [
        {
          "values": [
            "active",
            "inactive",
            "deleted"
          ],
          "fields": [
            "state"
          ],
          "type": "EXACT"
        },
        {
          "values": [
            "THE_EMAIL_ADDRESS_TO_SEARCH_AGAINST"
          ],
          "operator": "AND",
          "type": "EXACT",
          "fields": [
            "email"
          ]
        }
      ]
    }

    Regards,



    ------------------------------
    Jerome Saint-Marc
    Senior Development Support Engineer
    ------------------------------



  • 4.  RE: Search users using email to check state

    Posted an hour ago

    Thank you so much!!! 



    ------------------------------
    Connor Maxwell
    -
    ------------------------------