cancel
Showing results for 
Search instead for 
Did you mean: 

API - Changes in List endusers?

API - Changes in List endusers?

dal
New Contributor II

Hi.

I have this python script where I list all endusers into a list and the iterate over it to find a spesific user.

This used to work fine, but not anymore.

The function looks like this:

def list_endusers(pageSize):                                # LIST ALL ENDUSERS IN DATABASE. NEEDED TO FIND IF USER EXISTS
        print("Retrieve all PPSK users from ExtremeCloudIQ")
        page = 1

        endusers = []

        while page < 1000:
            url = URL + "/endusers?page=" + str(page) + "&limit=" + str(pageSize)
            print("Retrieving next page of PPSK users from ExtremeCloudIQ starting at page " + str(page) + " url: " + url)

            # Get the next page of the endusers
            response = requests.get(url, headers=headers, verify = True)
            if response is None:
                print("Error retrieving PPSK users from XIQ - no response!")
                return

            if response.status_code != 200:
                print("Error retrieving PPSK users from XIQ - HTTP Status Code: " +
                      str(response.status_code))
                print(response)
                print(response.content)
                return

            rawList = response.json()['data']
            for name in rawList:                            #### UNTAG THESE TO SEE ALL USERS
                print(name)                                 #### UNTAG THESE TO SEE ALL USERS
            print("Retrieved " + str(len(rawList)) + " users on this page")
            endusers = endusers + rawList

            if len(rawList) == 0:
                #print("Reached the final page - stopping to retrieve users ")
                break

            page = page + 1

        return endusers

I get this error:

<Response [400]>
b'{"error_code":"UNKNOWN","error_id":"ff98e0177ca64c7d9a775385fbff00c9","error_message":"UNKNOWN"}'

Has there been any changes to the API that can cause this?

In the Swagger UI page, I can see to new(?) options:
- user_group_ids
- usernames

Do they need to be filled out (not optionable)? If so, is there a wildcard that can be used to find usernames?

Thanks.

3 REPLIES 3

2delarosa
Extreme Employee

The api endpoint worked for me as well.  Back in April, we introduced a parameter to search by usernames.  This parameter eliminates the need to download and parse the entire enduser payload response, which is especially useful in a large organization.  Please note that the value entered is case-sensitive.

dal
New Contributor II

I have tried both directly in swagger UI here and from my python scripts.
If I leave both fields blank, it throws an error code 400. If I fill out one of the fields, it seems to work.

Searching by usernames is a welcome addition, and something I requested about a year ago.
Excellent. I just wish there was a way to use a wildcard in the username, though.

I have altered my python scripts now, so it's not really an issue anymore as long as the correct method is known.

I have another problem, though. But I can make another thread for that.

Thanks.

 

 

TylerMarcotte
Extreme Employee

I just tried the call from swagger without needing to fill them out and it worked fine for me. I also tried via python using requests and didn't run into the issue.

Can you try adding some debug or print statements to see the full URL or requests that's being submitted?

GTM-P2G8KFN