Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch Patch request #293

Open
B33T opened this issue Mar 20, 2020 · 1 comment
Open

Batch Patch request #293

B33T opened this issue Mar 20, 2020 · 1 comment

Comments

@B33T
Copy link

B33T commented Mar 20, 2020

Hello, Any chance you could update the docs with a batch patch request, I cannot seem to make it function.

I am using this

$subscriber_hash = MailChimp::subscriberHash($email); $thebatchname = "op".$batchno; $result = $Batch->patch("$thebatchname","lists/$list_id/members/$subscriber_hash", [ 'merge_fields' => ['FNAME'=>"$first_name", 'LNAME'=>"$last_name"], 'status' => "$subscriber", ]); $batchno = $batchno +1;

Array ( [id] => 7a6a1780a6 [status] => pending [total_operations] => 0 [finished_operations] => 0 [errored_operations] => 0 [submitted_at] => 2020-03-20T15:47:37+00:00 [completed_at] => [response_body_url] => [_links] => Array ( [0] => Array ( [rel] => parent [href] => https://us19.api.mailchimp.com/3.0/batches [method] => GET [targetSchema] => https://us19.api.mailchimp.com/schema/3.0/Definitions/Batches/CollectionResponse.json [schema] => https://us19.api.mailchimp.com/schema/3.0/CollectionLinks/Batches.json ) [1] => Array ( [rel] => self [href] => https://us19.api.mailchimp.com/3.0/batches/7a6a1780a6 [method] => GET [targetSchema] => https://us19.api.mailchimp.com/schema/3.0/Definitions/Batches/Response.json ) [2] => Array ( [rel] => delete [href] => https://us19.api.mailchimp.com/3.0/batches/7a6a1780a6 [method] => DELETE ) ) )

the same command with post works perfectly any ideas? or can you elaborate on its usage with the docs? I have stared at this code now for a good few hours with little joy and I swear it's going to be something simple.

PS I know the code is untidy / crap its because I have been messing around for hours attempting to get it going!

@B33T
Copy link
Author

B33T commented Mar 20, 2020

This code does work, but oftentimes out because of so many entries

$subscriber_hash = MailChimp::subscriberHash($email)
$result = $MailChimp->patch("lists/$list_id/members/$subscriber_hash", [
'merge_fields' => ['FNAME'=>''.$first_name.'', 'LNAME'=>''.$last_name.''],
'status' => ''.$subscriber.'',
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant