Create new record with asset gallery example

Hello there!

Could someone help me with my JS Client Item logic.

// wrong 
const product = await client.items.create({
    itemType: '555444222',
    shopifyId: '2356678345',
    key: '555444222'
    assetStacks: {
       uploadIds: '12345, 34567'
    }, // INVALID_FORMAT for field type "asset gallery"
});

This is currently returning a 500 status response code and I can’t find the documentation for the expected payload structure for the field type “asset gallery”.

if field type is media → “single asset”, then expected format of value should be

{
    uploadId: '12345'
}

if field type is media → “asset gallery”, then ??? I tried

{
  uploadIds: '12345, 34567'
}

and this is wrong.

hello @niko welcome to Community!

Yes, sorry about misisng doc. We are right now in the process of reworking it to add those missing details.

In you case you should pass an array of objects like this:

{
    alt: null,
    title: null,
    customData: {},
    uploadId: '12345',
}

for every asset.

Let me know if that works for you!

1 Like

Thank you @mat_jack1 !

1 Like

Hey @mat_jack1,

I have similar issue, but object structure you’ve provided is probably wrong.
I get message:
Value not acceptable for this field type

@adam maybe you have validations in place? Can you please share what you are doing so that I can have a look?