cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
760
Views
5
Helpful
3
Replies

Cisco Unity Connection API - Powershell

SomethingWitty
Level 1
Level 1

I'm working on a script to connect to the Cisco Unity Connection API via PowerShell to reset a user's VM pin.  I can get the ObjectID just fine but for whatever reason I can't get it to work to reset the VM pin.

 

$Username = ''

$Password = ''

$PIN = '1234'

$EncodedAuthorization = [System.Text.Encoding]::UTF8.GetBytes($Username + ':' + $Password)

$EncodedPassword = [System.Convert]::ToBase64String($EncodedAuthorization)

$Headers = @{

    Authorization = "BASIC $($EncodedPassword)"

    Accept        = 'application/json'

}
$r = Invoke-RestMethod -Uri 'https://IP/vmrest/users/?query=(alias is ALIAS)' -Headers $Headers

$objectid = $r.User.ObjectId

$response = Invoke-RestMethod 'https://IP/vmrest/users/OBJECTID/credential/pin

' -Method 'Put' -Headers $headers

$response

I've also tried:

$response = Invoke-RestMethod 'https://IP/vmrest/users/OBJECTID/credential/pin?PIN=1234' -Method 'PUT' -Headers $headers

I'd appreciate any guidance here.

 

TIA

3 Replies 3

Recommend you to head over to DevNet for this type of question as it’s better suited than this community.



Response Signature


I thought that's what I was doing?  Following the links on DevNet directed me here to ask for assistance.  I'm guessing I went wrong somewhere.

davidn#
Cisco Employee
Cisco Employee

Hi there,

 

The API is expecting new PIN data in JSON format (body), not as a parm in the URI. For example:

 

PUT https://<Connection-server>/vmrest/users/<user-objectid>/credential/pin
Accept: application/json
Content-type:  application/json
Connection: keep-alive
Response Body:
{
  "Credentials":"cisco1234"
}

 

Hope that helps.

 

David