A space to discuss online store customization, theme development, and Liquid templating.
I am inserting a template into an existing theme for a Shopify store. I recovered the theme that was in use using a GET to the admin API with X-Acess-Token.
I then GET the product template and make a copy of the JSON.
I want to PUT the product template into the theme with a suffix e.g. product.iwantthat.json
And every time I try to put I get a 404 error not found.
Following this guideline in the API for creating an Asset
https://shopify.dev/docs/api/admin-rest/2024-07/resources/asset#put-themes-theme-id-assets
This is the JSON being PUT to the store theme and the URL in Postman
{ "asset": { "key": "templates/product.iwantthat.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}" } }
https://{{storeUrl}}/admin/api/2024-07/themes/{{themeid}}/assets.json
This is returning 404 not found. I am sure I am missing something but not sure what. I should be able to PUT that template in easily.