GraphQL aliases don't work correctly

Hi,

I’m trying to use the GraphQL API to get a set of items by SKU in a single request. As far as I can tell from the GraphQL docs, this should be possible via aliases. However, aliases as described on that page don’t seem to work with Shiphero. Instead, I get an errors array that spits back the aliases as the messages, and all of the products returned are duplicates of the one I specified last. It also doesn’t seem to give any complexity data for such requests.

For example:

Request ID: 5f19dda494e5a7f7ec460ec9

Query:

query {
  one: product(sku: "100") {
    request_id
    complexity
    data {
      sku
      name
      barcode
    }
  }
  two: product(sku: "110") {
    request_id
    complexity
    data {
      sku
      name
      barcode
    }
  }
}

Response:

{
  "errors": [
    {
      "message": "'one'"
    },
    {
      "message": "'two'"
    }
  ],
  "data": {
    "one": {
      "request_id": "5f19dda494e5a7f7ec460ec9",
      "complexity": null,
      "data": {
        "sku": "110",
        "name": "Example product name",
        "barcode": "110-001"
      }
    },
    "two": {
      "request_id": "5f19dda494e5a7f7ec460ec9",
      "complexity": null,
      "data": {
        "sku": "110",
        "name": "Example product name",
        "barcode": "110-001"
      }
    }
  }
}

Are aliases simply not supported? If not, is there any way to get a subset of items by SKU other than individually requesting each one?

Hi @jfmontanaro!

That is correct, at the moment we don’t support aliases.
To see the product details you will have to:

  1. Fetch them by one using SKU filter
  2. Fetch many at a time using the products query
  3. Get them all at once using the Inventory Snapshot mutation

Let me know if that would work for you

However, I did submit a Feature Request to our Engineering team about adding this compatibility.
I will let you know as soon as I get a response to it.
Thanks in advance!
Tom

Hi Thomas, thanks. I should be able to make do with requesting products one-at-a-time for now, I was just hoping there might be a slightly more efficient way to do it.