Update Subscriber API

ian

New Member
Hi,

If anyone can give me any pointers I'd appreciate it.

I am trying to update an existing subscriber using the api.

I just need to update one or two custom fields based on a subscriber's action when on a webpage. Similar to performing an on click action but on a link click or form submit on a webpage.. I'm passing List ID and Subscriber ID in the url from an email


// UPDATE EXISTING SUBSCRIBER
$response = $endpoint->update($listUid, $subUid, array(

'CUSTOMFIELD1' => 'VALUE1',
'CUSTOMFIELD2' => 'VALUE2',

));

From what i have tried out the API must update all fields rather than just specific fields so I can't just update fields in the above manner...

I'm guessing I have to call all of the subscribers values then use Update Existing Subscriber to add in my custom field values...

If this is quick and easy and anyone can give me an easy solution how to do this I'd appreciate it....

If it is not so straight forward I am happy to post in the services required section to get paid help.

Seems like I almost should be able to figure it out but relying on my intellect would be a dangerous rabbit hole of hours googling solutions that I can see would kill my day.....
 
Thanks for the quick reply, appreciated....

if I do as above i get:

MailWizzApi_Params Object
(
[_data:MailWizzApi_Params:private] => Array
(
[status] => error
[error] => Please provide the subscriber email address.
)

[_readOnly:MailWizzApi_Params:private] =>
)

If I add email value:

'EMAIL' => 'myemail@domain.com',
CUSTOMFIELD1' => 'VALUE1',
'CUSTOMFIELD2' => 'VALUE2',

Then it is successful however FNAME, LNAME and any other values not specified as above are overwritten with a null value.

I don't know much about php... I was trying to get values so I could use existing data for those that don't need updating eg:

'EMAIL' => $data['EMAIL']

but probably showing my lack of knowledge here...

Again, thanks for the quick reply... really makes a difference to have such quick support...
 
Hi, yes just updated to latest... version 1.3.9.9

Didn't try to do this before today in the previous version I had.
 
Can you please unzip attached and put the resulted .php file in /apps/common/components/utils/ to overwrite the existing file with same name, then try it again and let me know how it goes?
Thanks.
 

Attachments

  • IOFilter.php.zip
    1.3 KB · Views: 7
This works in that it will update just the required fields when the 'EMAIL' value is present.

Without an EMAIL value the following error occurs as before:

[error] => Please provide the subscriber email address.

Many thanks for your assistance
 
ok great - thanks for your help...


is there a way I can assign the existing value to the email value or would I have to pass the email in the url?

'EMAIL' => '$Exisitng'
 
@ian - Please unzip attached and put resulted file in apps/api/controllers to overwrite existing file with same name, then try again, this time without sending the EMAIL field.
Let me know how it goes.
Thanks.
 

Attachments

  • List_subscribersController.php.zip
    6.5 KB · Views: 11
That's great works a treat. Awesome support much appreciated....

"Change subscriber custom field on link click" action on a web page - brilliant. Very handy :)
 
Back
Top