Retrieve all Refunds with Creation Date with Bulk Graphql API

achempak
Tourist
8 0 1

Hi,

I'm trying to retrieve all refunds using the bulk GraphQL API. Everything *almost* works perfectly; however, I realized I'm unable to get the `createdAt` field for refunds. Below is the query I'm using. Is is impossible to get this information for refunds by using the regular GraphQL api?

 

mutation {
    bulkOperationRunQuery (
      query: """
        {
          orders(query: "financial_status:partially_refunded OR financial_status:refunded") {
            edges {
              node {
                id
                name
                displayFinancialStatus
                displayFulfillmentStatus
                createdAt
                updatedAt
                note
                subtotalPriceSet {
                  shopMoney {
                    amount
                  }
                }
                totalDiscountsSet {
                  shopMoney {
                    amount
                  }
                }
                totalTaxSet {
                  shopMoney {
                    amount
                  }
                }
                totalPriceSet {
                  shopMoney {
                    amount
                  }
                }
                totalRefundedSet {
                  shopMoney {
                    amount
                  }
                }
                
                lineItems {
                  edges {
                    node {
                      id
                      sku
                      product {
                        id
                        handle
                      }
                      fulfillmentStatus
                      quantity
                      fulfillableQuantity
                      refundableQuantity
                      originalUnitPriceSet {
                        shopMoney {
                          amount
                        }
                      }
                      discountedUnitPriceSet {
                        shopMoney {
                          amount
                        }
                      }
                      taxLines {
                        priceSet {
                          shopMoney {
                            amount
                          }
                        }
                        rate
                        ratePercentage
                        title
                      }
                    }
                  }
                }
                
                transactions {
                  id
                  kind
                  amountSet {
                    shopMoney {
                      amount
                    }
                  }
                }
              }
            }
          }
        }
      """
    ) {
      bulkOperation {
        id
        status
      }
      userErrors {
        field
        message
      }
    }
  }

 

 

0 Likes
achempak
Tourist
8 0 1

Is the only alternative do use this query and iterate through all refunds?

 

{
  orders(first: 8, query: "financial_status:partially_refunded OR financial_status:refunded") {
    pageInfo {
      hasNextPage
    }
    edges {
      cursor
      node {
        id
        refunds {
          createdAt
          updatedAt
          refundLineItems(first: 20) {
            edges {
              node {
                lineItem {
                  id
                }
                quantity
                subtotalSet {
                  shopMoney {
                    amount
                  }
                }
                totalTaxSet {
                  shopMoney {
                    amount
                  }
                }
                priceSet {
                  shopMoney {
                    amount
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

 

0 Likes