We use the API to add subscribers with custom fields and all works fine. Now though, we need to add a bit more functionality which has led to needing another custom field. Its basically for a competition, but some of the subscribers will be existing, and we're finding that if we try and subscribe an exisitng person with a custom field, instead of just updating that particular custom field, its also deleting the other in the other custom fields.
eg Subscriber sign up and we use API to set custom field 'source' to 'Website contact form' - this works fine
Same subscriber then enters our January competiton - we add the subscriber again with the custom field 'comp' set to Jan_09. Now, when I view the subscriber the 'source' data has dissapeared.
Is this how its intended to be? surely is should only update fields that have had data passed in?
I'm not using custom fields, but I guess you have to fetch the old custom keys and then combine the old and new ones.
BTW. The 24 hour customer support seems to be sleeping
Tinus is correct, if you are using the API to update the custom fields of an existing subscriber, any missing fields will be emptied. For the functionality you've described above, you need to:
(a) first call Subscriber.GetSingleSubscriber, which will return (among other things), all of the populated custom fields for that subscriber.
(b) then call Subscriber.AddWithCustomFields with the current custom fields (changing what you wish you change, deleting what you wish to delete), and any new data.
Hope that helps,
Hi Phil, thanks for the reply.
I dont seem to be able to get a response from Subscriber.GetSingleSubscriber - other functions work fine, but when I make a call to that and then debug I get:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: Sorry, but we've run into a problem. Please try again or contact support at Pronto.API.ExceptionHandlers.TryThis[T](WebService service, Func`1 body) at Pronto.api.api.GetSingleSubscriber(String ApiKey, String ListID, String EmailAddress) --- End of inner exception stack trace ---</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
Edit - the code I'm using is:
$user = $cm->makeCall( 'Subscribers.GetSingleSubscriber' , array( 'params' => array( 'ListID' => 'mylistid in here' , 'Email' => 'test email here' ) ) );
Thanks for your response. The most likely reason for a response like that is because one or other of the parameters (either the ListID or Email) is corrupt and/or missing. We have had several instances in the last few hours of Subscriber.GetSingleSubscriber being called without an email address, so i'd check to see you're populating that value correctly.
If that doesn't help, send your code through to support and we'll have a look at it there.
Just bumping this as we put it on ice and have just revisited.
It seems its a problem with the documentation on:
In there, at the top it says the parameters are:
Your API application key. See here for more details.
The list you want to add the subscriber to. See here for more details.
The email address of the new subscriber.
Thats what I used in my example above. However, in the example SOAP request on that page I noticed that instead of Email its called EmailAddress. When I changed my code to that variable name it worked fine.
You might want to update the docs.