Theme API & config/settings_data.json asset

Highlighted
Excursionist
33 0 6

Has anyone successfully created the asset: config/settings_data.json for a theme via the API?

I have tried to do so using PUT /admin/themes/#{id}/assets.json; and, while the asset is successfully created (API returns 200), it is not created with the value that I provided in the API request.

I also tried base64 encoding the JSON payload and passing it as an attachment in the request; this too returned 200 but the content of the asset was still not what I passed in the API…

Is this a known bug/deficiency in the API?

0 Likes
Highlighted
Shopify Partner
57 0 20

I've seen this issue. Any type of warning prevents it from updating. I didn't even know you can create a blank theme without a settings_data.json file. Are you sure it doesn't exist? Did you check the response of the API PUT call?

I've had a lot of issues trying to update some settings_data.json files. Some work fine while others require substantial parsing to try to fix the warnings on the fly (copying from theme to theme).

0 Likes
Highlighted
Excursionist
33 0 6

Hi Jason,

Thanks for replying.

We've tried a number of different things and settled on a work-around that appears to be doing the job for us. Less than ideal because it feels like an API bug to us, but I don't think it's a common enough use case in the API to garner any attention from the Shopify team :(

 

Cheers,

James

0 Likes
Highlighted
Shopify Partner
1 0 1

Hi @seashellski

 

I have had success with this:

 

let response = await shopify.asset.update(theme.id, { 
    key: 'config/settings_data.json', 
    value: JSON.stringify(themeConfig),
  });

Where themeConfig is a normal JSON object.

 

1 Like