I am trying to add a product suffix template to a theme programmatically using the admin API. We connect to the API using the X-Access-Shopify-Token and store URL, we get the active theme ID, then we get the product template, and then we want to post a copy of the product template as product.clearance.json. When I go to PUT the template back into the theme I get a 404 error. The product.clearance.json file is a replica of the product but is used only for clearance items that pass that template back to our web app where we process clearance product data.
I have been able to successfully GET both the theme and template, but when I try to PUT them back, nothing happens.
This is the URL path (I think is correct)
https://{{storeUrl-iwt}}/admin/api/2024-07/themes/{{themeid}}/assets.json
and the JSON file I am trying to PUT into the theme.
{
"asset": {
"key": "templates/product.clearance.json", // Path and file name of the new template
"value": "{\n \"sections\": {\n \"main\": {\n \"type\": \"main-product\",\n \"blocks\": {\n \"vendor\": {\n \"type\": \"text\",\n \"settings\": {\n \"text\": \"{{ product.vendor }}\",\n \"text_style\": \"uppercase\"\n }\n },\n \"title\": {\n \"type\": \"title\",\n \"settings\": {\n }\n },\n \"price\": {\n \"type\": \"price\",\n \"settings\": {\n }\n },\n \"variant_picker\": {\n \"type\": \"variant_picker\",\n \"settings\": {\n \"picker_type\": \"button\",\n \"swatch_shape\": \"circle\"\n }\n },\n \"quantity_selector\": {\n \"type\": \"quantity_selector\",\n \"settings\": {\n }\n },\n \"development_iwt_modal_button\": {\n \"type\": \"shopify:\\/\\/apps\\/development\\/blocks\\/iwt-modal-button\\/8530d116-d113-4019-a57e-7c7f122435f9\",\n \"settings\": {\n }\n },\n \"buy_buttons\": {\n \"type\": \"buy_buttons\",\n \"settings\": {\n \"show_dynamic_checkout\": true,\n \"show_gift_card_recipient\": true\n }\n },\n \"description\": {\n \"type\": \"description\",\n \"settings\": {\n }\n },\n \"share\": {\n \"type\": \"share\",\n \"settings\": {\n \"share_label\": \"Share\"\n }\n }\n },\n \"block_order\": [\n \"vendor\",\n \"title\",\n \"price\",\n \"variant_picker\",\n \"quantity_selector\",\n \"development_iwt_modal_button\",\n \"buy_buttons\",\n \"description\",\n \"share\"\n ],\n \"settings\": {\n \"enable_sticky_info\": true,\n \"color_scheme\": \"scheme-1\",\n \"media_size\": \"large\",\n \"constrain_to_viewport\": true,\n \"media_fit\": \"contain\",\n \"gallery_layout\": \"stacked\",\n \"media_position\": \"left\",\n \"image_zoom\": \"lightbox\",\n \"mobile_thumbnails\": \"hide\",\n \"hide_variants\": true,\n \"enable_video_looping\": false,\n \"padding_top\": 36,\n \"padding_bottom\": 12\n }\n },\n \"related-products\": {\n \"type\": \"related-products\",\n \"settings\": {\n \"heading\": \"You may also like\",\n \"heading_size\": \"h2\",\n \"products_to_show\": 4,\n \"columns_desktop\": 4,\n \"color_scheme\": \"scheme-1\",\n \"image_ratio\": \"square\",\n \"image_shape\": \"default\",\n \"show_secondary_image\": true,\n \"show_vendor\": false,\n \"show_rating\": false,\n \"columns_mobile\": \"2\",\n \"padding_top\": 36,\n \"padding_bottom\": 28\n }\n }\n },\n \"order\": [\n \"main\",\n \"related-products\"\n ]\n}"
}
}
Not sure why a 404 error is what I am getting.