GraphQL adding new Zones to Delivery Profile

GraphQL adding new Zones to Delivery Profile

Matt_SCP
Visitor
1 0 0

I am trying to figure out how to add new Zones and Methods to existing Delivery Profiles. I tried to create a new profile and add all the zones at once, but I got an error saying my payload was too large. So I then started trying to find a way to create a Delivery Profile, then add all the zones 1 at a time. The problem I'm facing is trying to figure out the combination in GraphQL to do that. All my attempts so far have either failed or completely overridden what was already there instead of adding to it. Can someone help me with this?

Replies 3 (3)

DataAutomation
Shopify Partner
2 0 0

Hey there, coworker of Matt_SCP here!

Wanted to add some more info and boost this post. 

So we used this documentation to establish an initial Python script that would add in all of the Zones at one time. We expected to accomplish all of the delivery profile set up needs and Zones in a singular call. But when we went to test this we ran into a data limit with the code we were submitting. 

Due to receiving the data limit, we then tried to pivot to create the Profile first and then amend it with each Zones specific needs individually. Using this documentation (supported by this doc as well) we were under the impression that we could update Profile with multiple Zone's. Meaning this call would append/add data to the object but in practice it is overwriting what was there before instead. 
 
We are thinking that there may be something off with our update call structure or an item that we are missing to be able to append new Zones to a Profile since multiple Zones are supported and used by our mutual client in store set up through the UI (done utilizing these instructions

Please help if you have any insight!!
DataAutomation
Shopify Partner
2 0 0

We've found a solution to the problem of overwriting zone data on update. The original mutation in the script was using a "locationGroupsToCreate" key; we need to use "locationGroupsToUpdate" and provide a location group ID.

We can't seem to find location groups in the UI, which would be useful... but in any case, when we make a GraphQL POST request with the change described above, it adds new zone information to the delivery profile rather than overwriting it entirely. So we should be able to use this method to make our requests sequentially (to avoid rate limiting) for every zone defined in the input.

Hope this helps someone in the future!

haleema
Shopify Partner
4 0 2

where can i get location group id because when i pass location id like this it throws error 

profile: {
                  locationGroupsToUpdate: {
                    id: 123456789,