Getting blank value on retrieves a single asset for a theme

Highlighted
New Member
2 0 0

Retrieve a Liquid template

GET /admin/api/2020-04/themes/#{theme_id}/assets.json?asset[key]=templates/index.liquid

When I have call this API but getting blank value.

My code:

$shop->api()->rest('GET', '/admin/api/2020-04/themes/#{theme_id}/assets.json?asset[key]=layout/theme.liquid);
API response:

 

 

Screenshot_1.png

0 Likes
New Member
2 0 0

I found the answer in the docs for ohmybrew/Basic-Shopify-API which is the API wrapper implemented in the laravel-shopify package. The url parameter needs to be passed as a separate parameter to the rest method, like so:

 

$assets = $shop->api()->rest('GET', '/admin/api/'.ShopifyApp::api()->getVersion().'/themes/80166092888/assets.json', ['asset[key]' => 'snippets/collection-grid-item.liquid']);

 

I have found solution from https://stackoverflow.com/a/59362832/5579711 

0 Likes