# Unable to upload Virtual Background using API

**URL:** <https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195>\
**Category:** API and Webhooks\
**Tags:** api\
**Created:** [July 21, 2023, 2:54pm UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195 "2023-07-21T14:54:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![philip.ross](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/philip.ross/32/19627_2.png) [@philip.ross](https://devforum.zoom.us/u/philip.ross)\
**Post date:** [July 21, 2023, 2:54pm UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195/1 "2023-07-21T14:54:35Z")

</div>

I’ve searched the history on the DevForum, but I can’t quite find a topic that matches what I’m looking for.

I’m having difficulty in using the “Upload Virtual Background Files” API at the Groups level.  
Endpoint: /groups/{groupID}/settings/virtual\_backgrounds

I’m not sure I’m formatting the request body quite correctly.  
Is there any guidance on what it should look like?

The reference docs say that it should be “file” with the format of multipart/form-data, but me trying to create this doesn’t work:

body=@{‘file’ = “/path/to/file”}

This returns as:  
Name Value

* * *

file /path/to/file

I’m using powershell to write the API calls, but used to converting tables into JSON objects etc for PATCH calls, and that works fine.

Any help is much appreciated!

---

<div class="post-metadata">

**Author:** ![philip.ross](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/philip.ross/32/19627_2.png) [@philip.ross](https://devforum.zoom.us/u/philip.ross)\
**Post date:** [July 28, 2023, 2:43pm UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195/2 "2023-07-28T14:43:13Z")

</div>

Update: I’ve managed to get this to work in Postman, and done some more digging on why it’s not working on Powershell.

So far I’ve found that I should be using the `-Form` switch on the `Invoke-RestMethod` command, but this was introduced in Powershell 6.1.0, so I need to use Powershell Core, rather than Windows Powershell (which has a ceiling of 5.1)

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [July 29, 2023, 12:23am UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195/3 "2023-07-29T00:23:28Z")

</div>

Hi @philip.ross thanks so much for sharing how you resolved!

---

<div class="post-metadata">

**Author:** ![philip.ross](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/philip.ross/32/19627_2.png) [@philip.ross](https://devforum.zoom.us/u/philip.ross)\
**Post date:** [August 1, 2023, 12:24pm UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195/4 "2023-08-01T12:24:23Z")

</div>

Okay - found this article:

> <https://stackoverflow.com/questions/36268925/powershell-invoke-restmethod-multipart-form-data>

Looks that it might be possible to do it manually with Windows Powershell, but I’ve taken the ‘easy option’ and started to use the latest versions of Powershell Core, so the OOTB functionality is now available.  
This is also probably worthwhile as means I can use recent features across other API endpoints, and APIs for other applications.

Confirmed that installing Powershell Core and then using the `-Form` parameter does work and upload the image successfully.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [August 4, 2024, 4:01am UTC](https://devforum.zoom.us/t/unable-to-upload-virtual-background-using-api/92195/5 "2024-08-04T04:01:17Z")

</div>

Closed on August 4, 2024, 4:01am UTC

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