更改Graphql查询,以便将每个产品显示在单独的行上

问题描述

Tl;博士:我需要更改Graphql查询,以便它将每个产品显示在单独的行上,并在其旁边的列中显示“ rateProvider”(或发货费率)数据。


我正在使用API​​ Connector插件在Google表格中使用以下查询检索Shopify API数据,并按照此处针对GraphQL的说明进行操作:https://mixedanalytics.com/knowledge-base/access-shopify-data-in-google-sheets/

查询检索Shopify产品及其交付配置文件。但是,所有产品都根据交货情况显示在一行中吗?例如,如果交货配置文件中有10个产品($ 100运费),则该交货配置文件的所有10个产品及其交货配置文件数据都将显示在一行中,例如下面的第一个示例。

但是我希望每个产品都显示在单独的行中,交货配置文件数据显示在其旁边的列中,就像下面的第二个示例一样*我也不确定如何为该查询设置适当的分页提取所有产品'。

示例1:
产品#1 |产品2 | deliveryProfile(运费为100美元)
产品#1 |产品2 | deliveryProfile(运费为50美元)

示例:2:
产品#1 | deliveryProfile(运费为100美元)
产品2 | deliveryProfile(运费为100美元)
产品#1 | deliveryProfile(运费为50美元)
产品2 | deliveryProfile(运费为50美元)

query ($cursor: String) {
  deliveryProfiles (first: 5) {
    edges {
      node {
        profileItems (first: 5,after: $cursor) {
          edges {
           cursor
            node {
              product {
                id
                handle
              }
              variants (first: 5) {
                edges {
                  node {
                    id
                    title
                  }
                }
              }
            }
          }
        }
        profileLocationGroups {
          locationGroupZones(first: 5) {
            edges {
              node {
                methodDeFinitions(first: 5) {
                  edges {
                    node {
                      rateProvider {
                        ... on DeliveryRateDeFinition {
                          id
                          price {
                            amount
                          }
                        }
                        ... on DeliveryParticipant {
                          id
                          fixedFee {
                            amount
                            currencyCode
                          }
                          percentageOfRateFee
                          participantServices {
                            active
                            name
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }        
      }
    }
  }
}

解决方法

已解决::如果您使用Google表格的API连接器(附加)从Shopify导入数据,并且使用GraphQL查询,则必须进入API连接器的[输出选项]菜单,然后将报告样式更改为[紧凑],以在各自的行上显示各个记录。