# Using bulkInsert to create new item in collection with Media Gallery

**URL:** <https://forum.wixstudio.com/t/using-bulkinsert-to-create-new-item-in-collection-with-media-gallery/58411>\
**Category:** Ask the community\
**Tags:** api, code, question, cms\
**Created:** [April 19, 2024, 5:15pm UTC](https://forum.wixstudio.com/t/using-bulkinsert-to-create-new-item-in-collection-with-media-gallery/58411 "2024-04-19T17:15:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Courtney\_Dean](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/courtney_dean/32/91056_2.png) [@Courtney\_Dean](https://forum.wixstudio.com/u/Courtney_Dean)\
**Post date:** [April 19, 2024, 5:15pm UTC](https://forum.wixstudio.com/t/using-bulkinsert-to-create-new-item-in-collection-with-media-gallery/58411/1 "2024-04-19T17:15:45Z")

</div>

Hello, I am trying to use the bulkInsert function to insert data from an api directly into a collection. The issue I am experiencing is creating the Media Gallery field using an external url. The following code works if the image has already been upload to wix, however using an external url like provided in the image1 field does not upload to the collection. When using the same code below but changing the “src” field to an external url, I get the following error: The value does not match the field type Media Gallery.

Is it possible to create a Media Gallery using external images? I can successfully upload to the image1 object using an external URL.

If this cannot be done, is there a way to put image1, image2, image3, etc in a Media Gallery?

Thanks for your assistance.

```javascript
const data = [
    {
        "myId": "006640de31",
        "title": "My Title",
        "imageGallery": [
            {
                "src": "wix:image://v1/45acdd_370e404c79404ac69e9932889247a1bd~mv2.jpg/Cute%2520french%2520Bulldog%2520puppy%252C%2520two%2520months%2520old.%2520selective%2520focus_edited.jpg#originWidth=3000&originHeight=1756",
                "type": "image"
            }
        ],
        "image1":"https://dgicdplf3pvka.cloudfront.net/383213/mini-goldendoodle-puppy-picture-c4c4e291-5aab-4e07-a596-930f94004106.jpg"
    }];            
            // Update Wix collection with fetched data
            wixData.bulkInsert('MyCollection', data)
                .then(results => {
                    console.log('Data updated successfully:', results);
                })
                .catch(error => {
                    console.error('Error updating data:', error);
                });

```

---

<div class="post-metadata">

**Author:** ![anthony](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/anthony/32/79536_2.png) [@anthony](https://forum.wixstudio.com/u/anthony)\
**Post date:** [April 22, 2024, 5:28pm UTC](https://forum.wixstudio.com/t/using-bulkinsert-to-create-new-item-in-collection-with-media-gallery/58411/2 "2024-04-22T17:28:02Z")

</div>

The Media Gallery type only supports wix URLs but you can read the external images into a buffer and [upload](https://www.wix.com/velo/reference/wix-media-backend/mediamanager-obj/upload) them with the media manager to then get wix URLs for them.

Also while it wont store multiple images it seems the normal Image type [might support external URLs](https://support.wix.com/en/article/cms-formerly-content-manager-supported-content-in-collection-field-types). Though I haven’t tested this:

 ![image](https://us1.discourse-cdn.com/wix/original/3X/1/4/149dcb77d5f1efd5a00362553b93004395ae8a18.png)
