How to create a draft order for a specific company using APIs and its company ID?

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?

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

1 Like