raltaie | 2018-10-03 17:13:05 UTC | #1
import PureCloudPlatformClientV2
PureCloudPlatformClientV2.configuration.access_token = 'dont post access tokens on the forum! Handle them like passwords!'
api = PureCloudPlatformClientV2.UsersApi()
expand = ["authorization"];
id = [];
pageNumber = 1;
pageSize = 25;
sortOrder = "ASC";
state = "active";
result = api.get_users(expand, id, pageNumber, pageSize, sortOrder, state)
print (result)
i use the code above and i get this error
result = api.getusers(expand, id, pageNumber, pageSize, sortOrder, state) TypeError: getusers() takes 1 positional argument but 7 were given
and in JavaScript it just ignore all the arguments and it gets the default api.getUsers() what am i missing ???
tim.smith | 2018-10-03 13:39:03 UTC | #2
Are you using the latest version of the Python SDK? I tested the example for UsersApi.get_users(...) shown in the docs and it works fine using the latest Python SDK (v43.0.0). Can you try using the example there as its written? There are a few differences from the code you wrote.
raltaie | 2018-10-03 17:03:17 UTC | #3
i used the same exact example and i got same error
So i am using python 3.7 and i did pip install PureCloudPlatformClientV2 which i assume that would be the latest SDK
please advise
tim.smith | 2018-10-03 17:13:55 UTC | #4
Are you sure you used the example exactly as it is on the page? It works the way it's written. I can reproduce your error by changing this:
api_response = api_instance.get_users(page_size=page_size, page_number=page_number, id=id, sort_order=sort_order, expand=expand, state=state)
to this:
api_response = api_instance.get_users(page_size, page_number, id, sort_order, expand, state)
The API functions use **kwargs, which require keyworded arguments. If that doesn't work, please post your latest code.
Edit: forgo to mention, if you're also having issues with the JavaScript SDK, please create a new topic with your issue in the JavaScript SDK category.
raltaie | 2018-10-03 17:16:35 UTC | #5
i am using the same code above ^
from https://developer.mypurecloud.com/api/rest/v2/users/
tim.smith | 2018-10-03 17:17:46 UTC | #6
That code is incorrect. Please use the example I linked.
Thanks for showing me where you got the bad code from. I'll create an issue to get that fixed.
raltaie | 2018-10-03 17:19:37 UTC | #7
well thank you i will try your code now then i will let you know
btw it's the same issue with Javascript Example as well
raltaie | 2018-10-03 17:36:19 UTC | #8
raltaie, post:1, topic:3665
"authorization"
i tried the example you sent and got this error again get_users() without it pull all data but once i use **kwargs i get the issues
please advise
tim.smith | 2018-10-03 17:40:06 UTC | #9
You specified an ID filter with no values. Getting a 404 not found from that request is normal. Try not providing the ID filter if you aren't wanting to retrieve specific users by ID.
raltaie | 2018-10-03 17:52:57 UTC | #10
it works like a charm Thank you Tim!
system | 2018-11-03 17:54:52 UTC | #11
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: 3665