New Shopify Certification now available: Liquid Storefronts for Theme Developers

Asset file not updating via API

andrew4real
Shopify Partner
5 0 2

Hi All,

 

How can I troubleshoot the 'Not Found' error when attempting to update a theme asset using the Shopify API with the scope 'write_themes'?

 

I have verified the correct theme ID and asset key, and ensured that the asset exists in the specified theme. Are there any additional considerations or permissions required to modify theme assets?

 

I am using shopify-app-template-php - I followed the documentation, please find my code below:

 

$asset = new Asset($session); //verified, OK
$asset->theme_id = $themeId; //verified, OK
$asset->key = "templates/product.liquid"; //verified, exists, OK
$asset->value = $updatedContent; //my updated content to product.liquid file. Basically I would like to add someghing like: {% include "my_custom_liquid" %} to product.liquid
$asset->save(true);

 


Response from Shopify\Exception\RestResourceRequestException:

 

REST request failed: "Not Found"

 

Many thanks!

Replies 0 (0)