Update users organization through API

답변함


2021년 9월 17일에 게시됨

I currently have my users connected through AD.  I work for a school district and the users organization is their school.  When my users change schools their organization doesn't update.  I am looking to update through the API and everything looks like it works with no error messages but nothing changes.  I even tried changing a users name and it looked like it worked but it didn't update.  Below is a snippet of my PowerShell code.

 

 

$url = 'https://{company}.zendesk.com/api/v2/users/'
$url = $url + {userID}
$url = $url + '.json'
$url

$zenname = {name}


$body = @{
user = @{
name = $zenname
organization_id = $orgid
}
}

$body = $body | ConvertTo-Json
$body

$headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($Username):$($Token)"))}
#$headers = $headers | ConvertTo-Json
$contenttype = 'application/json'
$method = 'PUT'

 

Invoke-RestMethod -method $method -Uri $url -headers $headers -body $body -verbose


0

3

댓글 3개

I am interested in this as well.

0


StatusCode : 200
StatusDescription : OK
Content : {"user":{"id":****,"created_at":"2020-08-20T13:25:04Z","updated_at":"2021...
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Connection: keep-alive
X-Zendesk-API-Version: v2
X-Zendesk-Application-Version: v9726
X-Frame-Options: SAMEORIGIN
X-Rate-Limit: 400
X-Rate-Limit-Remai...
Forms : {}
Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [X-Zendesk-API-Version, v2], [X-Zendesk-Application-Version, v9726]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 868

0


Hey there,

Everything looks correct from what I can see. Can you provide an example of your body's output when you log the request to the console?

Have a wonderful day!

Eric Nelson | Manager - Developer Advocacy

0


로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물