Skip to content

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

Open

Description

@krjo

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"

}

Activity

  1. fredbegin11 commented on Jan 17, 2024

    @fredbegin11

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions