[REST Admin API] - Error 422 Unprocessable Entity

[REST Admin API] - Error 422 Unprocessable Entity

mario-unkel
Shopify Partner
2 0 0

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

 

 

 

 

Replies 0 (0)