Best way to retrieve 3PL client list with basic info?

Hi Guys,
I need to retrieve list of our 3PL customers/clients with their basic info:

id
legacy_id
name
email
account_number
account_id
internal_note
default_po_note
partner_vendor_id
created_at

I first tried to run a paginated Vendors query, but it just kept on running for hours, fetched 100,000+ entries didn’t end yet - I had to cancel (no idea what it kept going on with but it did have some valid client names on first 100 items that I verified). But we have just 70 clients at the moment - any idea why it retrieved so many more results?

Then I looked into 3PL docs and found Customers query, but it seems to only retrieve ID field.

I would like to run this query a few times each day to ensure I have the latest/updated list. To get all the info what’s the most efficient and recommended way?

Thank you!
Raj

Hey @Raj,

Thanks for reaching out!
Going to look into this and get back to you shortly.

Best,
RayanP

1 Like

Hey @Raj,

Thanks for hanging in there.
We do have a query for getting child accounts! I think something like this is the closest we have to what you’re looking for:

{
  account{
    request_id
    complexity
    data {
      id
      legacy_id
      customers(first: 10) {
        edges {
          node {
            id
            legacy_id
            email
            username
          }
        }
      }
    }
  }
}

You’re also able to add this warehouse fragment under the customers if this would be any use to you:

 warehouses {
    id
    legacy_id
    account_id
    identifier
    dynamic_slotting
    invoice_email
    phone_number
    profile
    address {
      name
      address1
      address2
      city
      state
      country
      zip
      phone
    }
    return_address {
      name
      address1
      address2
      city
      state
      country
      zip
      phone
    }
    company_name
    company_alias
    products(
      sort: "string"
      before: "string"
      after: "string"
      first: 1
      last: 1
    ) {
      pageInfo
      edges
    }
  }
}

Please let me know if you have any questions!

Best,
RayanP

1 Like

Thank you @sh-agent for the quick solution! That’s extremely helpful - I just tested it and it works great!
I even tried adding the internal_note and default_po_note fields just to try my luck but that didn’t work lol

I suppose there’s no way to query the created date and/or the two note fields?
Also, would you know why the Vendors query gave me 100K+ results?

Hey @Raj,

Unfortunately, I don’t believe there’s a way to query for a client account by those filters.
Regarding the vendors query, do you by chance have a request id for that one?
Going to try to recreate by myself in the meantime.

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

Best,
RayanP

Hey @sh-agent, Yes sure, here’s a request id that I just ran and cancelled at 600 results “634ea48cdfb333551b9223b6”

And here’s my query:

		  vendors {
			request_id
			complexity
			data(first: 100) {
			  edges {
				node {
				  id
				  legacy_id
				  partner_vendor_id
				  account_id
				  account_number
				  name
				  created_at
				  email
				  internal_note
				  default_po_note
				}
			  }
 			  pageInfo{
				endCursor
				hasNextPage
			  }
			}
		  }
1 Like

While you’re looking into that (hopefully), I have a QQ - your suggested query gives me multiple ID fields - which one should I be saving as my client ID here? And what’s the use of the other ones?

I’m guessing the legacy_id field is for backwards compatibility and isn’t very useful if I’m creating something new?

Thank you!

Hey @Raj,

Are you still experiencing issues running that vendors query? I was able to run it in your account with no problems using the same query you sent.

Sorry for the confusion regarding ID’s, let me explain!

Under node the id and legacy id are actually the same, and this is what you should be saving as your client id. I believe the legacy id is just the id Base64 decoded.

Under warehouses the account id shows you which account the warehouse is linked to. The id under warehouses is the warehouse id.

It is quite a bit confusing, let me know if I wasn’t clear or if you have any questions or concerns.

Best,
RayanP

1 Like

Omg @sh-agent I feel so dumb right now - I was asking for the endcursor in my original query but never providing the ‘after: [endcursor]’ parameter in subsequent queries, and the results just kept on fetching the same first page over and over again (massive facepalm!).

But thank you for the explanation on the IDs - I’m definitely adding it to my notes for future reference.

Now I just have one question remaining - See, in the account/customers query you gave me, the results contain the correct set of 71 clients we currently have. But my vendors query (now fixed) contains 154 results - are there some status: inactive entries included there maybe? Any way to filter them out?

Thank you so much!

Hey @sh-agent, sorry to bug you again, but any idea about this?
I tried to compare valid client entries to the ones that I don’t see in SH web interface, and I don’t see a clear differentiator that might help me ignore those results.

Hey @Raj,

No worries, looking into this one now.
I’ll have an update for you shortly.

Best,
RayanP

1 Like

Hey @Raj,

I’m a little confused. Could you share an example of what you mean by valid client entries?

We aren’t able to filter statuses of a vendor through our Public API. I also tested adding a vendor then deleting it to see if that alters the number of vendors returned through the query and it did not.

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

Best,
RayanP

Hey @sh-agent, I just sent you a PM with all the details.

1 Like