How to get "RMA Number" seen in UI from "returns" query

I am trying to get a list of returns that includes each return’s “RMA number”. Specifically, the RMA Number that is displayed in the ShipHero UI “All Returns” list.

Here is the query I am using to get a list of return objects:

{returns(date_from:“2020-09-21”){complexity data(first:10 ){pageInfo{hasNextPage endCursor} edges{node{id partner_id order{order_number rma_labels{id tracking_number}} reason status reason created_at exchanges{exchange_items{id sku quantity}} line_items{ id return_id type reason quantity line_item{sku price} condition}}}}}}

How can I include the RMA Number in this query? Or get the RMA number in some secondary query?

Hi @bbarrett!
That field should be named legacy_id I believe, which is the id but base64 encoded.
You can use a base64 decoder to turn "id": "UmV0dXJuOjE0NDg2NjE=" into Return:1448661 (1448661 is the RMA number seen on the UI)
or you can include the legacy_id on the Query, something like this:

{
  returns(date_from: "2020-09-01") {
    complexity
    data(first: 10) {
      pageInfo {
        hasNextPage
        endCursor
      }
      edges {
        node {
          id
          legacy_id
          partner_id
          order {
            order_number
            rma_labels {
              id
              tracking_number
            }
          }
          reason
          status
          reason
          created_at
          exchanges {
            exchange_items {
              id
              sku
              quantity
            }
          }
          line_items {
            id
            return_id
            type
            reason
            quantity
            line_item {
              sku
              price
            }
            condition
          }
        }
      }
    }
  }
}

Let me know if this doesn’t help or I could explain better.
Thanks in advance!
Tom