使用 Shopify graphql admin api 操作文件

发布于 2025-01-11 22:19:19 字数 343 浏览 2 评论 0原文

我想使用 Shopify 沙箱中的 deleteFile 方法删除文件。但是,deleteFile 方法需要文件 ID,而 File 对象不需要不包含 id 属性。

所以我的问题是如何在 shopify graphql 中获取文件 id ?

I want to delete a file using deleteFile method from Shopify sandbox. However deleteFile method is requiring file id and the File object doesn't contain id property.

So my question is how do I get file id in shopify graphql ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

濫情▎り 2025-01-18 22:19:19

您需要获取媒体图像 id,但需要获取图像 id。
因此,您可以使用 MediaImage 上的 ... 请求这种类型的 id

query files($count: Int, $cursor: String) {
  files(first: $count, after: $cursor, sortKey: CREATED_AT, reverse: true) {
    edges {
      cursor
      node {
        ... on MediaImage {
          id
          image {
            height
            width
            url
          }
        }
        __typename
      }
    }
  }
}

You need to get Media Image id but an Image id.
So, you can request this type of id using ... on MediaImage

query files($count: Int, $cursor: String) {
  files(first: $count, after: $cursor, sortKey: CREATED_AT, reverse: true) {
    edges {
      cursor
      node {
        ... on MediaImage {
          id
          image {
            height
            width
            url
          }
        }
        __typename
      }
    }
  }
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文