Location/locations queries are broken

Hello,

Making a location or locations query results in SOME data being returned, but most of the data is still missing/invalid and I get an unexpected error sometimes as well even with data returned. This results in incomplete data for any other query I make, such as inventory_changes with location in the response. Getting all locations also fails because my client has more than 1 location but only 1 location is returned.

Example 1:

query{
	location(id: "OMITTED_FOR_SECURITY") {
    request_id
    complexity
    data {
      id
      legacy_id
      account_id
      warehouse_id
      type {
        id
        legacy_id
        account_id
        name
        daily_storage_cost
      }
      name
      zone
      pickable
      sellable
      is_cart
      pick_priority
      dimensions {
        weight
        height
        width
        length
      }
      temperature
      last_counted
      created_at
    }
  }	
}

Response:

{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "location",
      "field": "id",
      "request_id": "5fbc00572f00adc64adca390",
      "code": 22
    }
  ],
  "data": {
    "location": {
      "request_id": "5fbc00572f00adc64adca390",
      "complexity": 1,
      "data": {
        "id": null,
        "legacy_id": 0,
        "account_id": null,
        "warehouse_id": null,
        "type": null,
        "name": null,
        "zone": null,
        "pickable": false,
        "sellable": false,
        "is_cart": false,
        "pick_priority": 0,
        "dimensions": null,
        "temperature": null,
        "last_counted": null,
        "created_at": null
      }
    }
  }
}

Example 2 (inventory_changes, previous_on_hand and change_in_on_hand, along with all of the other data is CORRECT. The location data is incorrect. The location_id is non-null but of course will return the same data as shown below in a location query by location_id:

query {
	  inventory_changes(sku: "OMITTED_FOR_SECURITY") {
    request_id
    complexity
    data (first: 1, sort: "-created_at") {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges {
        node {
          user_id
          account_id
          warehouse_id
          sku
          previous_on_hand
          change_in_on_hand
          reason
          cycle_counted
          location_id
          created_at
          location {
            id
            legacy_id
            account_id
            warehouse_id
            type {
              id
              legacy_id
              account_id
              name
              daily_storage_cost
            }
            name
            zone
            pickable
            sellable
            is_cart
            pick_priority
            dimensions {
              weight
              height
              width
              length
            }
            temperature
            last_counted
            created_at
          }
        }
        cursor
      }
    }
  }
}

Response:

{
  "errors": [
    {
      "message": "Unexpected Error",
      "operation": "inventory_changes",
      "field": "id",
      "request_id": "5fbc06a852eded689bf525a1",
      "code": 22
    }
  ],
  "data": {
    "inventory_changes": {
      "request_id": "5fbc06a852eded689bf525a1",
      "complexity": 2,
      "data": {
        "pageInfo": {
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "OMITTED_FOR_SECURITY",
          "endCursor": "OMITTED_FOR_SECURITY"
        },
        "edges": [
          {
            "node": {
              "user_id": "OMITTED_FOR_SECURITY",
              "account_id": "OMITTED_FOR_SECURITY",
              "warehouse_id": "OMITTED_FOR_SECURITY",
              "sku": "OMITTED_FOR_SECURITY",
              "previous_on_hand": 6,
              "change_in_on_hand": -1,
              "reason": "OMITTED_FOR_SECURITY",
              "cycle_counted": false,
              "location_id": "OMITTED_FOR_SECURITY",
              "created_at": "OMITTED_FOR_SECURITY",
              "location": {
                "id": null,
                "legacy_id": 0,
                "account_id": null,
                "warehouse_id": null,
                "type": null,
                "name": null,
                "zone": null,
                "pickable": false,
                "sellable": false,
                "is_cart": false,
                "pick_priority": 0,
                "dimensions": null,
                "temperature": null,
                "last_counted": null,
                "created_at": null
              }
            },
            "cursor": "OMITTED_FOR_SECURITY"
          }
        ]
      }
    }
  }
}

Example 3 (get all locations):

query {
  locations {
    request_id
    complexity
    data (first: 5) {
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges {
        node {
            id
            legacy_id
            account_id
            warehouse_id
            type {
              id
              legacy_id
              account_id
              name
              daily_storage_cost
            }
            name
            zone
            pickable
            sellable
            is_cart
            pick_priority
            dimensions {
              weight
              height
              width
              length
            }
            temperature
            last_counted
            created_at
        }
        cursor
      }
    }
  }
}

Response (only 1 location, but the client has more than 1 location, and clearly the data looks incomplete):

{
  "data": {
    "locations": {
      "request_id": "5fbc07eecf4f707bfcb78806",
      "complexity": 6,
      "data": {
        "pageInfo": {
          "hasNextPage": false,
          "hasPreviousPage": false,
          "startCursor": "OMITTED_FOR_SECURITY",
          "endCursor": "OMITTED_FOR_SECURITY"
        },
        "edges": [
          {
            "node": {
              "id": "OMITTED_FOR_SECURITY",
              "legacy_id": OMITTED_FOR_SECURITY,
              "account_id": "OMITTED_FOR_SECURITY",
              "warehouse_id": "OMITTED_FOR_SECURITY",
              "type": null,
              "name": "Unassigned",
              "zone": "OMITTED_FOR_SECURITY",
              "pickable": true,
              "sellable": true,
              "is_cart": false,
              "pick_priority": OMITTED_FOR_SECURITY,
              "dimensions": {
                "weight": null,
                "height": null,
                "width": null,
                "length": null
              },
              "temperature": "OMITTED_FOR_SECURITY",
              "last_counted": null,
              "created_at": "OMITTED_FOR_SECURITY"
            },
            "cursor": "OMITTED_FOR_SECURITY"
          }
        ]
      }
    }
  }
}

Please advise.

Hi @nturk
Thanks for that detailed description!

It looks like you are making the Query from the Customer account. This query needs to be made from the 3PL.
The reason it is this way is that the locations belong to the 3PL account and not the customer, and when making this Query the location id will return null and showing that unexpected error message.

We are working on adding a customer_account_id to the Query but in the meantime try using a Bearer from the 3PL.

Let me know if I can explain better or there is anything I could help with.
Thanks in advance!
Tom

Hi @tomasw,

Thanks for your reply in good time.

I am not sure what you mean by 3PL account, how is that different/where can I get access to that account? The customer account is used to post orders and query for other data, so why is inventory data separate?

Thanks

Hey @nturk!

The reason there are operations that need to be done from the 3PL side, or on the Customer Account is that they have different roles in the process, the same as the UI.

For example:

  1. The order gets created: This is on the Customer account, where the shops and products are located.

  2. The order gets allocated from different locations/bins, shipped and inventory decremented: This happens on the 3PL account because they manage the warehouse and its locations.*

*On the UI, it works the same way, the Customer account doesn’t have any access to the Bins and Locations, in order not to mess with the 3PL’s inventory.

Let me know if this still doesn’t make sense or I could explain better.
Thanks again!
Tom

Hi @tomasw,

That makes sense. How do I get access to the 3PL account in order to generate a BearerToken to read Locations data for the Customer?

Thanks

Absolutely @nturk !
You could create one on the 3PL account by using the UI actually:

On Adding a Third-Party Developer we have an video on how to do this.
The bearer you will be getting there should be good enough to perform operations on the 3PL

Let me know if that doesn’t help,
Thanks again!
Tom

Hi @tomasw

I have another client and connected to their ShipHero account by creating a Third Party Developer, since we got blocked by ShipHero’s API and kept getting a response that stated ShipHero would email the client with instructions on how to get unblocked. They never got an email. But that’s a separate issue.

I just tested the same queries above, using the Third Party Developer bearer token, and I get the same exact results, even though this client has locations as well. Locations can be clearly seen in the Inventory Log of an item. Example response from querying for 1 existing location seen in the Inventory Log:

{
  "errors": [
    {
      "message": "Location not found",
      "operation": "location",
      "field": "data",
      "request_id": "5fc17a05a19972185239eb0e",
      "code": 5
    }
  ],
  "data": {
    "location": {
      "request_id": "5fc17a05a19972185239eb0e",
      "complexity": 1,
      "data": null
    }
  }
}

Hi @nturk!
Send me an email to twingord@shiphero.com with the user details so I can unlock that user and see what might be causing it to be locked.

As for the Query, the reason you are seeing location not found is the same as before, the email from the user making that request is associated with the Customer account. So in this case it returns Location Not found because the Customer doesn’t have that location (or any location last all)
You will need to create the third-party developer user on the 3PL to be able to perform this query and get the response back.
Send me the email if you want or post it here and we can take a look and unlock that user.
Thanks again!
Tom