[ARCHIVED] Login API - Adding an additional login to a user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 = "https://utm.test.instructure.com/api/v1/accounts/1/logins?user[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)
utm.test.instructure.com/api/v1/accounts/1/logins?user[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...
Bruce Harrison
Univ. of Tennessee at Martin
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.