Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi all,
I would like to update .liquid files throught the Admin REST API, but I keep getting an 422 Unprocessable Entity error.
To be more precise, the error I get is:
"body": { "errors": { "asset": [ "Missing {{content_for_header}} in the head section of the template", "Missing {{content_for_layout}} in the body section of the template" ] } }
This would make sense, if I would actually be missing this in my template. But it's right there. See below the code I would like to update:
{ "asset": { "key": "layout/theme1.liquid", "value": "<html>\r\n<head>\r\n{{content_for_header}}\r\n<title>{{ shop.name }} - {{ page_title }}</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\r\n{{ \"screen.css\" | asset_url | stylesheet_tag }}\r\n</head>\r\n<body>\r\n{{content_for_layout}}\r\n</body>\r\n</html>" } }
I've tried everything, but I don't see what's wrong. Any ideas on what this could cause this?
On top of that; I can save the file manually in the UI without issues.
Thank you
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025