cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
943
Views
5
Helpful
1
Replies

CUPI API - Modify User COS with Python

theflyingwombat
Beginner
Beginner

I am trying to modify a voicemail user's COS in Unity Connection with Python. I have been able to create users and edit other settings such as alternate extension but a simple modify is stumping me. Running my code results in a <response [204]> which is a success but the COS did not update.

 

import requests
import json
baseUrl = "https://unity.loves.com/vmrest/"

end_user_objectid = '527aad83-6739-409c-a70c-792a8ca55536' headers_edit = {'Accept': 'application/json', 'Content_type': 'application/json', 'Connection': 'keep_alive'} cos = {'CosObjectId': 'c33d4edd-79e3-44fa-bb57-20b8d2d39998'} s = requests.post(baseUrl + "users/" + end_user_objectid, auth=(apiUser, apiPassword), headers=headers_edit, json=cos, verify=False) print(s) print(s.text)
1 Accepted Solution

Accepted Solutions

theflyingwombat
Beginner
Beginner

Figured it out.  Just needed to change POST to PUT.  

 

s = requests.put(baseUrl + "users/" + end_user_objectid, auth=(apiUser, apiPassword), headers=headers_edit, json=cos, verify=False)

View solution in original post

1 Reply 1

theflyingwombat
Beginner
Beginner

Figured it out.  Just needed to change POST to PUT.  

 

s = requests.put(baseUrl + "users/" + end_user_objectid, auth=(apiUser, apiPassword), headers=headers_edit, json=cos, verify=False)
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: