Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with shopify.asset.create - Shopify API version 2023-04 #605

Open
krjo opened this issue May 20, 2023 · 1 comment
Open

Help with shopify.asset.create - Shopify API version 2023-04 #605

krjo opened this issue May 20, 2023 · 1 comment

Comments

@krjo
Copy link

krjo commented May 20, 2023

I can't get shopify.asset.create to add a new file to a theme. I know the theme ID is correct as I am able to use asset.get to retrieve a file. But asset.create and asset.update both return 404 errors. I'm using the same params that other posts have shown to be successful. Does anyone see what's wrong?

const asset = {
    key: "snippets/test.liquid",
    value: "Content"
  }

  await shopify.asset.create(themeId, asset)

Response:

{

  "errors": "Not Found"

}
@fredbegin11
Copy link

fredbegin11 commented Jan 17, 2024

Hey!

I know I'm 6 months late, but Shopify made some changes to the asset API starting from 2023-04.

Ref: https://shopify.dev/docs/api/admin-rest/2023-04/resources/asset

Starting with Admin API 2023-04, if an app distributed through the Shopify App Store uses the Asset resource to create, edit or delete a theme's asset, you need to request the required protected access scope. In most cases, you shouldn't use the Asset resource. To learn more about when you can use the Asset resource, and how to migrate, refer to the [Asset resource](https://shopify.dev/docs/apps/online-store/other-integration-methods/asset).

Basically, starting in 2023-04, you can't update or delete assets anymore without Shopify granting you the required access scopes.

I guess this is why shopify-api-node is throwing 404's on those endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants