Syntax for PUT /api/v2/users/{userId}/routingskills/bulk

Hello, I'm trying to create a python script that reads a csv to bulk update an agents skill. I am trying to test my function but keep getting a 400 malformed syntax error when testing. Here are two different syntax's I've tried with no luck.

def addskill(id):
# create an instance of the API class
api_instance = PureCloudPlatformClientV2.UsersApi(api_client)
user_id = id # str | User ID
body = [PureCloudPlatformClientV2.UserRoutingSkillPost()]
body[0].id = {skillid}
body[0].proficiency = '3'
try:
# Add routing skill to user
api_response = api_instance.post_user_routingskills(user_id, body)
print(api_response)
except ApiException as e:
print("Exception when calling UsersApi->post_user_routingskills: %s\n" % e)

def addskill(id):
# create an instance of the API class
api_instance = PureCloudPlatformClientV2.UsersApi(api_client)
user_id = id # str | User ID
body = [
{
"id": {skillid},
"proficiency": 3
},
{
"id": {skillid},
"proficiency": 2
}
]
print(body)
try:
# Add routing skill to user
api_response = api_instance.post_user_routingskills(user_id, body)
print(api_response)
except ApiException as e:
print("Exception when calling UsersApi->post_user_routingskills: %s\n" % e)

1 Like

I suggest you experiment with https://developer.genesys.cloud/devapps/api-explorer#put-api-v2-users--userId--routingskills-bulk and compare the JSON it generates against yours?

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