406 when creating a snippet

Highlighted
New Member
5 0 0

I seem to be getting a 406 Unacceptable when I try to create a snippet. I was creating something more complex but it doesn't even seem to work with the example in the API docs.

 

Here's my fetch:

  const body = {
    asset: {
      key: "snippets/lol.liquid",
      value: "<p>something</p>" 
    }
  };

  
const response = await fetch(url, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
      'X-Shopify-Access-Token': accessToken,
      body: JSON.stringify(body)
    }
  });

And I all I get is 406 Unacceptable back. The `X-Shopify-Request-Id` is 'bbf8ad8a-0817-4cc7-8bf0-f6b39b2bf9be'.

 

Any help would be appreciated.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1040 139 163

Hey @hmg23 

 

The body isn't coming through. From the snippet it looks like you might have it in the headers accidentally.

0 Likes