Solved

Trying to update theme with PUT request results in 406 error

marioguy08
Shopify Partner
6 1 1

Hey, so I am currently trying to update the products.liquid page of the default theme by making a PUT request to the API but I always get a 406 error on postman and my app. I have followed the documentation on https://shopify.dev/api/admin/rest/reference/online-store/asset#index-2021-07 but I cannot get the put request to work. Here is a screenshot of my postman:

marioguy08_0-1627706172623.png

 

I have my auth token as a header so that isnt the issue and I know that the theme id is correct, and I also have access to write to themes. My X-Request-ID is 4a016b88-43c8-4d10-b30a-f8004906f154. If anyone here who works at Shopify could check my requests and tell my whats wrong that would be great, or maybe someone knows what else could be causing the 406 error. Thanks!

Also get requests work fine

 
Accepted Solution (1)

GrahamS
Shopify Staff (Retired)
193 36 54

This is an accepted solution.

Hello @marioguy08 ,

Taking a quick look at the request id you provided, it looks like the internal error is '404'. I expect this is because with a PUT request, the system seeks to update an existing file within the directory you are requesting, which may be a problem here. You are sending requests to /assets, which as a folder does not hold template files. Things like product.liquid would be held in the 'templates' folder, which is not accessible through the /assets endpoint.

I hope this helps!

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Reply 1 (1)

GrahamS
Shopify Staff (Retired)
193 36 54

This is an accepted solution.

Hello @marioguy08 ,

Taking a quick look at the request id you provided, it looks like the internal error is '404'. I expect this is because with a PUT request, the system seeks to update an existing file within the directory you are requesting, which may be a problem here. You are sending requests to /assets, which as a folder does not hold template files. Things like product.liquid would be held in the 'templates' folder, which is not accessible through the /assets endpoint.

I hope this helps!

Best,

Graham

To learn more visit the Shopify Help Center or the Community Blog.