I have a large dataset that I need to push to the account-level shipping settings in Google Merchant Center. I am using the Google Shopping API via the PHP Client Library.
If I load a subset of the data and call it once at the end, it works fine:
$settings = $clientservice->shippingsettings->get('XXXXXX', 'XXXXXX');
for each data point that represents a service
for each data point that represents a rate group
create weight/destination state table
next
next
$settings->setServices($services);
$updatedSettings = $clientservice->shippingsettings->update('XXXXXX', 'XXXXXX', $settings);
However, if I load the entire set of data and try to apply it at once, I get a 413 Request Too Large response. So I would like to load it incrementally, one service at a time. I tried this:
$settings = $clientservice->shippingsettings->get('XXXXXX', 'XXXXXX');
for each data point that represents a service
for each data point that represents a rate group
create weight/destination state table
next
$settings->setServices([$service]);
$updatedSettings = $clientservice->shippingsettings->patch('XXXXXX', 'XXXXXX', $settings);
next
However, each service just overwrites the previous one. "patch" seems to operate just like "update", as best I can tell. Anyone know how to make this work?
Not 100% sure i understand the question part of your question. However I can tell you this Update will update all of the fields you send with the request. say we have an object
class Foo {
public $aname= 'Jane';
public $aaddress = '12 Blueberry Hill';
public $aage = '23';
}
If i do an update
update('Jane Doe', '12 Blueberry Hill');
It expects all of the fileds to be sent in this instance age will probably be set to null because it wasnt included in the request.
Now patch will only update the fields you include
update('Jane Doe', '112 Blueberry Hill');
so this request will update name and address and not touch age.
If you are having an issue with size then you should see if the api you are using includes the fields optional parameter i think most of the Google apis do. Then you could request only the fields you want to update and then send a patch with that.