I have referred below document from cisco site followed the same but it is not working, so kindly help me on this issue,
https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/connection/REST-API/CUPI_API/b_CUPI-API/b_CUPI-API_chapter_0100000.html#reference_02033599713C4E76B1FC92DDB6E5E6EF
Import a User
POST http://<server>/vmrest/import/users/<type>?templateAlias=<voice mail user template> with an ImportUser object
An important point here is that because these users are imported, almost all values come from the internal database. One exception for an LDAP import is the dtmfAccessId. The dtmfAccessId data is not available in the internal database, so an LDAP import must specify both a pkid and a dtmfAccessId.
POST /vmrest/import/users/ldap?templateAlias=voicemailusertemplate HTTP/1.1 Content-Type: application/json User-Agent: Java/1.6.0_20 Host: cuc-install-69.cisco.com Accept: text/html, image/gif, image/jpeg, \*; q=.2, \*/*; q=.2 Connection: keep-alive Authorization: Basic Y2NtYWRtaW5pc3RyYXRvcjplY3NidWxhYg== Content-Length: 126 \{"alias":"sdavis","firstName":"sonya","lastName":"davis","dtmfAccessId":"12123","pkid":"c2e2bf1c-f249-40e5-b7b8-31a5b0333647"\}
For example:
The POST above would produce the following response:
HTTP/1.1 201 Created
my code :
URL = 'https://{}/vmrest/import/users/ldap?templateAlias=voicemailusertemplate'.format(server)
UserHeaders = {'Accept':'text/html, image/gif, image/jpeg, \*; q=.2, \*/*; q=.2' , 'content-type':'application/json','connection':'keep_alive'}
data = {
'alias': 'testdevops',
'firstName': 'test',
'lastName': 'devops',
"dtmfAccessId": "1908",
'pkid': '8a15a6ab-965a-de21-c3e1-af48dcaa3f97'
}
try:
response = requests.post(URL, headers = UserHeaders, data= data, auth=(username, password), verify=False)
I was getting this error when tried to make post request using python,
'The HTTP header field "Accept" with value "text/html, image/gif, image/jpeg, \\*; q=.2, \\*/*; q=.2" could not be parsed.'