A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're struggling to create a draft order associated with a company using APIs and a company ID.
We found this documentation but we're struggling to retrieve the companyLocationId and companyContactId information. The only information we have is the Company ID.
How could we create draft orders for our testing company from API using only its Company ID?
Solved! Go to the solution
This is an accepted solution.
Hey @Thibaut-M - thanks for getting in touch. You should be able to pull this information through the company object in GraphQL directly, provided your app/integration has the read_customers scope and is being tested on a Plus Shop. Here's a quick example if you wanted to pull multiple companies and the relevant contact/location info:
{
companies (first:10) {
edges {
node {
id
name
contacts (first:10) {
edges {
node {
id
}
}
}
locations (first:10) {
edges {
node {
id
}
}
}
}
}
}
}
If you know the Shopify GID of the company you want to query, you would also be able to query the same fields, using the ID as an argument on the company object itself. Hope this helps!
Al | Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @Thibaut-M - thanks for getting in touch. You should be able to pull this information through the company object in GraphQL directly, provided your app/integration has the read_customers scope and is being tested on a Plus Shop. Here's a quick example if you wanted to pull multiple companies and the relevant contact/location info:
{
companies (first:10) {
edges {
node {
id
name
contacts (first:10) {
edges {
node {
id
}
}
}
locations (first:10) {
edges {
node {
id
}
}
}
}
}
}
}
If you know the Shopify GID of the company you want to query, you would also be able to query the same fields, using the ID as an argument on the company object itself. Hope this helps!
Al | Shopify Developer Support
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog