How to identify Shopify app embed is active/inactive in the theme?

Dzonotonas
Shopify Partner
15 1 7

Hi 👋

I want to implement this banner in my app:

Dzonotonas_0-1693764129771.png

 

Which Shopify API can return to me a status active/inactive in the current theme?

I found a similar thread, but it's outdated I think: 

https://community.shopify.com/c/authentication-and-access/enable-app-embed-on-installation-of-app/td...

Replies 3 (3)

Dzonotonas
Shopify Partner
15 1 7

I think this one I need:

 

/admin/api/2023-07/themes/{theme_id}/assets.json?asset[key]=config/settings_data.json

 

But the app, which is built using Remix template, returns a 401 error 🤔 How to pass the correct authentication credentials?

Murgesh
Shopify Partner
12 0 1

Hi,

did you get any solution, since Asset API's are deprecated not sure how to get status for extension enable or disable?

Dzonotonas
Shopify Partner
15 1 7
Shopify API version: 2024-01

I use this code:

 

const sessionId = await shopify.session.getCurrentId({
  isOnline: true,
  rawRequest: req,
  rawResponse: res,
});

const session = await sessionHandler.loadSession(sessionId);

const client = new shopify.clients.Rest({ session });
const response = await client.get({
  path: "assets",
  query: {
    "asset[key]": "config/settings_data.json",
  },
});