Get a Return Shipping Label

 mutation (
    $orderNumber: String!
    $warehouseId: String!
    $returnReason: String!
    $address: AddressInput!
    $lineItems: [CreateReturnLineItemInput!]!
    $returnLabelType: ReturnLabelType!
    $labelCost: String!
    $createLabel: Boolean!
  ) {
    return_create(
      data: {
        order_id: $orderNumber
        warehouse_id: $warehouseId
        return_reason: $returnReason
        label_type: $returnLabelType
        label_cost: $labelCost
        create_label: true
        address: $address
        shipping_carrier: "UPS"
        shipping_method: "Ground"
        line_items: $lineItems
        dimensions: { weight: "0", height: "0", length: "0", width: "0" }
      }
    ) {
      request_id
      return {
        id
        legacy_id
      }
    }
  }

I’ve tried accessing the rma_labels as suggested here Return Shipping Label and its API.

Also the labels under the Return itself. Both are empty.

Anyone able to help me understand, how do I query the return label?

Thank you!

Ordin

Hey @unitech,

Thanks for reaching out and Welcome to our Developer Community!

Are you having issues with your return create mutation? If you are could you send me the request id from your problem mutation.

To query the return label you can run a mutation similar to this:


{
  return(id: "4574399") {
    request_id
    complexity
    data {
      id
      legacy_id
      account_id
      order_id
      label_type
      label_cost
      shipping_carrier
      shipping_method
    }
  }
}
``

Please let me know if you have any questions or concerns.

Best,
RayanP
`

Hey @sh-agent thank you for getting back to me! I don’t think i’m having troubles creating a return, but I am having troubles locating anything to do with the actual label.

My latest request id is 64621ae13ef112bd2e73d6a3, if you can take a look and let me know how to retrieve the label (image, pdf) location for this that would be awesome!

Thank you

Hey @unitech,

I understand.

To get the pdf location of an RMA label you can run this query:

{
  return(id: "4574399") {
    request_id
    complexity
    data {
      id
      legacy_id
      account_id
      order_id
      label_type
      label_cost
      shipping_carrier
      shipping_method
      labels{
        pdf_location
        tracking_number
        status
      }
    }
  }
}

If you are trying to return the label upon return_create, you’d need to call these fields. Using your example mutation the end result would look something like this:

mutation (
    $orderNumber: String!
    $warehouseId: String!
    $returnReason: String!
    $address: AddressInput!
    $lineItems: [CreateReturnLineItemInput!]!
    $returnLabelType: ReturnLabelType!
    $labelCost: String!
    $createLabel: Boolean!
  ) {
    return_create(
      data: {
        order_id: $orderNumber
        warehouse_id: $warehouseId
        return_reason: $returnReason
        label_type: $returnLabelType
        label_cost: $labelCost
        create_label: true
        address: $address
        shipping_carrier: "UPS"
        shipping_method: "Ground"
        line_items: $lineItems
        dimensions: { weight: "0", height: "0", length: "0", width: "0" }
      }
    ) {
      request_id
      return {
        id
        legacy_id
        account_id
        order_id
        label_type
        label_cost
        shipping_carrier
        shipping_method
      labels{
        pdf_location
        tracking_number
        status
      }
      }
   }
}

Please let me know if you have any questions or concerns.

Best,
RayanP

Hey @sh-agent,

I have tried running the query you recently provided, using the latest return. However, I’ve noticed that the ‘labels’ field consistently comes back as empty. This has been the case for approximately the last dozen queries I have executed.

Do you have any insight into why the ‘labels’ field might be returning empty consistently?

Hey @unitech,

Thanks for the quick replies.

Would you mind sharing a request id where the query comes back empty? I looked for Order T3JkZXI6MTMzNTcwNDU0 in your account and was unable to find anything.

Please let me know if you have any questions or concerns.

Best,
RayanP

Hey @sh-agent , a request id 64621ae13ef112bd2e73d6a3 is and a return id is 4834779, an order id is #63073WO. All of these should yield labels as far as I understand.

thanks so much for your help, really appreciate it.

1 Like

Hey @sh-agent I just realized you’d be looking under my account. You won’t find anything there. I’ve asked my colleague who probably has the right account connection to chime in on this thread. I believe the id’s i’ve provided will yield results under his account.

1 Like