Asset file not updating via API

andrew4real
Shopify Partner
6 0 4

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 2 (2)

monarul007
Visitor
1 0 0

@andrew4real  Did you got any workaround or solution for this problem. I am also getting this error and unable to figure out the real problem. The app have these permissions: "write_products,read_script_tags,write_script_tags,read_themes,write_themes"

andrew4real
Shopify Partner
6 0 4
Unfortunately, no. I left it as is and focused on stores with Theme 2.0.