# Location/locations queries are broken

**URL:** https://community.shiphero.com/t/location-locations-queries-are-broken/974
**Category:** GraphQL API
**Created:** [November 23, 2020, 7:07pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974 "2020-11-23T19:07:32Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![nturk](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nturk](https://community.shiphero.com/u/nturk)
#### Post date: [November 23, 2020, 7:07pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/1 "2020-11-23T19:07:32Z")

</div>

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.**

---

<div class="post-metadata">

### Author: ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)
#### Post date: [November 24, 2020, 2:29pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/2 "2020-11-24T14:29:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![nturk](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nturk](https://community.shiphero.com/u/nturk)
#### Post date: [November 24, 2020, 4:10pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/3 "2020-11-24T16:10:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)
#### Post date: [November 24, 2020, 6:20pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/4 "2020-11-24T18:20:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![nturk](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nturk](https://community.shiphero.com/u/nturk)
#### Post date: [November 24, 2020, 7:06pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/5 "2020-11-24T19:06:38Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)
#### Post date: [November 24, 2020, 7:42pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/6 "2020-11-24T19:42:15Z")

</div>

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

> **[Getting Started – Developer Resources | ShipHero](https://developer.shiphero.com/getting-started/#authentication)**

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

---

<div class="post-metadata">

### Author: ![nturk](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@nturk](https://community.shiphero.com/u/nturk)
#### Post date: [November 27, 2020, 10:16pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/7 "2020-11-27T22:16:48Z")

</div>

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
> }
> }
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)
#### Post date: [November 28, 2020, 1:07pm UTC](https://community.shiphero.com/t/location-locations-queries-are-broken/974/8 "2020-11-28T13:07:57Z")

</div>

Hi @nturk!  
Send me an email to [twingord@shiphero.com](mailto: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
