Showing results for 
Search instead for 
Did you mean: 
Community Member

Login API - Adding an additional login to a user

Working in powershell to script some Canvas things.  Have done a fair amount in PS with the Canvas APIs.

Trying to create an additional login for a user via the login API 

POST /api/v1/accounts/:account_id/logins

In powershell I have:

$postParams = @{"user[id]"=$internalID;"login[unique_id]"=$userIN;"login[sis_user_id]"=$userIN}
$canPost1 = (invoke-WebRequest -Headers $headers -contentType $contentType -body $postParams -Method POST -uri $canPost)

I'm getting   System.Net.WebException: The remote server returned an error: (422) Unprocessable Entity.

I've also tried

 $canPost = "[id]="+$InternalID+"&login[unique_id]="+$userIN+"&login[sis_user_id]="+$userIN

#$canPost1 = (invoke-WebRequest -Headers $headers  -contentType $contentType -Method POST  -uri $canPost)

It generates the url (left out the https:// so it would show properly in this question)[id]=22164&login[unique_id]=chazlewo&login[sis_user_id]=chazlewo

Get similar error.  Any of you powershell gurus see anything I'm doing wrong?  I've not had this problem with creating users via API.  Error message doesn't give a lot of info...  Smiley Happy

Bruce Harrison

Univ. of Tennessee at Martin

0 Kudos
0 Replies