Trying to update User Type field. Getting Unsupported Content Type

Description
Trying to update user ( PATCH /users/{userId}) Type (License (2) to Basic (1)) and getting

Error
{“code”:300,“message”:“Unsupported Content Type”}

Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT

Which Endpoint/s?

How To Reproduce (If applicable)
Steps to reproduce the behavior:

p

Screenshots (If applicable)

{ “type”: 1 }
https://api.zoom.us/v2/users/vy5NdVA3S9Ca5OTdZP8ngA
Invoke-WebRequest: C:\Users\svaughn\Desktop\Zoom Licenses-20201117T183041Z-001\Zoom Licenses\demote-candidates.ps1:18:17
Line |
18 | … $response = Invoke-WebRequest -Uri $url -Headers $headers -Method Pat …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {“code”:300,“message”:“Unsupported Content Type”}

Hey @steven.n.vaughn,

A few things to check:

  • Can you make sure you’re using the correct HTTP method (POST) for creating a user?
  • Ensure the content type for your request body is JSON
  • Check that you’re passing a header for Content-Type with value application/json

Let me know if this helps!

Best,
Will

Thanks for responding Will

I am trying to Update information on a user’s Zoom … To be specific. I am trying to update the Type value to change some users from licensed to basic (2 to 1).

This is the api documentation page I am trying to use: https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userupdate

I am able to get user information, so I have worked though the jwt and header specifications:T

$headers = @{
“Accept”=“application/json”
“Authorization”=“Bearer $jwt”
}

The api page specifies the PATCH http verb be used, but I tried POST as you suggested, and I get the same :

{“code”:300,“message”:“Unsupported Content Type”}

The URL I am using is:

https://api.zoom.us/v2/users/GUT77j3kThSUBUWPPqRZyw

The body I am presenting is:

{ “type”: 1 }

The powershell statement I use to make the call is:

$response = Invoke-WebRequest -Uri $url -Headers $headers -Method PATCH -Body $body

or
$response = Invoke-WebRequest -Uri $url -Headers $headers -Method Post -Body $body

The response I get is:

Invoke-WebRequest: C:\Users\svaughn\Desktop\Zoom Licenses\demote-candidates.ps1:18:17
Line |
18 | … $response = Invoke-WebRequest -Uri $url -Headers $headers -Method Pat …

{"code":300,"message":"Unsupported Content Type"}

I add the Content-Type header as you suggested:

$headers = @{
“Accept”=“application/json”
“Authorization”=“Bearer $jwt”
“Content-Type”=“application/json”
}

Now get a different response:

Hey @steven.n.vaughn,

My apologies—I did not catch that you’re trying to update rather than create. You’re correct in that you should be using a PATCH request for Update User requests.

It looks like your final sentence got cut off unfortunately. Have you tried submitting this request in Postman to see if you get the same error? Your request should look something like this:

Let me know, thanks!
Will

Thanks for your help Will.

Your first note was right on the money actually. You suggested “Check that you’re passing a header for Content-Type with value application/json”

That was necessary.

And it led me to question another header I was using. Once I removed the header “Accept” “application/json” it worked.

Steve

I’m glad to hear that did the trick, @steven.n.vaughn!

Best,
Will