Legacy Dev Forum Posts

 View Only

Sign Up

Python SDK get_users method not returning the output in a valid json format

  • 1.  Python SDK get_users method not returning the output in a valid json format

    Posted 06-05-2025 18:08

    hporandla | 2023-01-26 15:02:39 UTC | #1

    Hello Team,

    I am running a python program to fetch the list of users in the genesys cloud for my organization and i am using the PureCloudPlatformClientV2 library and I have attached the python script which i am executing, somehow the response of the below method call doesn't return a valid json. I have attached the output of this method call to this ticket.

    apiinstance.getusers(id=id)

    Somehow for other method calls i get a valid json response (list or dict) for example get_systempresences()

    Could you please guide me on why we are not seeing a valid json response and please suggest ways to convert this method output to valid json.

    Appreciate your response on this.

    [get-users-python.yml

    attachment](upload://blyGC5gmRTAjwadBRhQjTg1uaM8.yml) (990 Bytes)

    [get-users-output.json

    attachment](upload://lwyqqp9s2PSpQmSIFzRklrgMSFS.json) (2.4 KB)


    John_Carnell | 2023-02-23 22:02:24 UTC | #2

    Hi Hari,

    Our python SDK is returning a Python class and not JSON. All of our Python classes are generated using our Swagger API. If you want to convert one of our classes to JSON, I suggest you look at:

    https://github.com/MyPureCloud/platform-client-sdk-python/blob/master/build/PureCloudPlatformClientV2/utils.py

    This method takes an object and converts it to JSON.

    Thanks, John Carnell


    hporandla | 2023-02-23 22:02:26 UTC | #3

    thanks @John_Carnell . your inputs helped me to resolve this problem.


    system | 2023-02-26 16:58:14 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 18154