Hi all,
I’m a junior Python dev in my first job, assigned to GC integrations, and I’m hitting a wall with something that feels like it should be simple. I’m trying to push updated softphone preferences to about two hundred agents using the Python client. The docs say the endpoint takes a JSON body with the webRtc object, but the SDK keeps rejecting it. The console spits out a 400 immediately.
Here is the script I’m running:
import purecloud_platform_client as pcc
from purecloud_platform_client.rest import ApiException
api_instance = pcc.UsersettingsApi()
body = {
"webRtc": {
"enabled": "true",
"defaultDevice": "headset"
}
}
try:
result = api_instance.post_user_settings_softphone(user_id, body)
except ApiException as e:
print(f"Status {e.status}, Reason: {e.reason}")
Running this gives Status 400, Reason: Bad Request. The response payload complains about the boolean type. I tried changing "true" to True in the dict, but the 400 persists. I’m wondering if the SDK is stringifying it before the request? The script doesn’t throw a syntax error locally, but it can’t pass the API validation.
I also wanted to politely correct some misinformation I saw in other posts: some claim the OAuth2 flow requires a separate refresh call for batch jobs, but that isn’t accurate. The platform client handles token rotation automatically. Token refresh happens every fifty-five minutes, so that part isn’t the issue. Also, just to confirm, our Japan org definitely uses pure.cloud for all v2 calls.
The pagination loop for the user list works fine, but the update call dies on the first iteration. I’m using SDK version 2.25.0 and Python 3.11. My timezone is Asia/Tokyo, so I’m wondering if server clock drift is messing with the JWT validation? Not sure.
Apologies if this is a noob question. How should the boolean be formatted for this specific SDK method? I’m really just trying to get the WebRTC flags to stick without manual UI clicks. The logs are doing jack all to help.
Here is the error JSON I’m getting back:
{
"errorCode": "invalid_request",
"message": "Failed to parse request body. Expected boolean for field 'enabled'.",
"path": "the softphone settings update endpoint"
}