Uploading User Pictures via API - 500 internal server error

Below is code in Powershell I am trying to run to upload a simple test picture, I’m posting because I’ve been using the API for 2 months now, and I’ve used every single call except this one, and I just seem to be missing something, but I’m not sure what. No matter what I do I receive the 500 internal server error, I copied and pasted the code generation from the API page, I feel as if I’m misunderstanding this API call. Any input appreciated.

$headers.Add(“content-type”, “multipart/form-data;”)
$headers.Add(“authorization”, “Bearer token”)
$body = @{}
$body.Add(“pic_file”, “C:\Temp\pic.jpg”)
$response = Invoke-RestMethod -Uri ‘https://api.zoom.us/v2/users/testuser@gmail.com/picture’ -Method POST -Headers $headers -Body $body

Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error.
At line:6 char:13

  • $response = Invoke-RestMethod -Uri 'https://api.zoom.us/v2/users/test
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

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

Which Endpoint/s?
POST # /users/{userId}/picture

How To Reproduce (If applicable)

Screenshots (If applicable)

Additional context
Add any other context about the problem here.

Hey @s.brandl,

Thank you for reaching out to the Zoom Developer Forum. Have you had a chance to test this in a REST client such as cURL or Postman? We have an excellent collection of requests in our Postman Collection that you can use for testing.

If you’re seeing the same issue in a REST client, please provide the request details that you are using for the REST client and I’ll investigate this further. If the request works in the REST client, I would review the script to ensure that it is performing the same steps as the REST client.

I hope that helps! Let me know if you have any questions.


Wanted to make sure I looped back around on this:

  • Thank you! for the suggestion to use Postman I can’t believe I’ve been doing APIs for this long, and I’ve never heard of this program.

  • Note for users trying to run the ‘Update a User’s Profile Picture’ the API web interface will not do it justice, as it can not see your desktop/file explorer to inject/parse the jpg file. Use postman to see some great code generation

  • Note for Powershell developers, multi-form data does not perform on Powershell v5.1 (the last version of powershell distributed by Microsoft automatically) I needed to upgrade to powershell 7 to get the code generated by Postman to work. I did not test Powershell v6, I jumped right to 7. Regardless, get up to the latest version of Powershell, the Zoom/Postman developers have put some serious work into keeping the methods up to date with the latest version tested.

Hey @s.brandl,

I’m glad to hear that was helpful! Postman is a great tool for testing APIs. As always, let us know if you encounter any further issues or questions.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.