使用Shopify graphql管理api操作文件



我想使用deleteFile方法从Shopify沙盒中删除一个文件。但是deleteFile方法需要文件id,而file对象不包含id属性。

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

您需要获得媒体图像id,但需要获得图像id。因此,您可以使用... on 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
}
}
}
}

最新更新