phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
568 stars 211 forks source link

PUT request on an Asset #280

Closed Cadams3443 closed 1 year ago

Cadams3443 commented 1 year ago

Never submitted an Issue on Github before but I am very stumped.

I wanted to change the HTML of a particular snippet file, I did my GET request to get the correct asset, it's key and it's value field. (Saved the key to a variable)

I changed the HTML I wanted and saved that to a variable. and I tried doing something like:

$this->sdk->Theme($theme[0]['id'])->Asset->put(['asset[key]' => $key, 'asset[value]' => $newValue])

I keep getting 406 errors. Am I missing something in the put args? I tried adding theme_id field in as well. Any help would be appreciated.

Cadams3443 commented 1 year ago

I got it working. For anyone looking at this in the future you need these params in your put request

$putRequestParams = [ 'key' => , 'value' => , 'source_key' => , 'theme_id' => ,

I think source_key and key are the same, at least I used the same value.

Good luck out there