UpdateMember
The UpdateMemberAPI allows one to create or update member information in the Frankly Media database.
Parameters
- member – A collection of member attributes in the XML format. See Remarks for the detailed description
- token – An encrypted string constructed using the passed-in parameters and the partner-specific “shared secret” provided by the Frankly Media. Unless requested differently by the partner, the MD5 hashing algorithm is used to produce the token. For the purpose of this call the following formula should be used: md5(ExMemberId+ ExSiteCode + UserName + Email + Password + timestamp + SubIDList + shared secret). ExMemberId, ExSiteCode, UserName, Email and Password are attributes of the member parameter (see Remarks for details). For the generic example refer to this article.
- timestamp – Verification timestamp. UTC time of the client call. Must be in the following format: YYYYMMDDHHmmss
Note: SubIdList is a string composed of SubscriptionID1 + OptIn1 + SubscriptionID2 + OptIn2 + SubscriptionIDN + OptInN. SubIdList can be left out of the token if Subscription information will not be sent with the request. Also you only need to include the subscriptions that you want to affect.
For example: “123true456true789false” where 123, 456, and 789 are valid subscription ID’s
How to call
This request is an http post. The contenttype attribute must be set to application/XML. The body of the post must be in the following format:
<UpdateMember xmlns=”https://www.franklymedia.com/ISubscriptions” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>
<member xmlns:a=”https://www.franklymedia.com/datacontract/XinbanClientMemberEx” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>
<a:MemberID>0</a:MemberID>
<a:ExMemberId>12345</a:ExMemberId>
<a:PartnerCode>StickyFish</a:PartnerCode>
<a:ExSiteCode>Friend</a:ExSiteCode>
<a:UserName>[email protected]</a:UserName>
<a:Email>[email protected]</a:Email>
<a:Password>xyj</a:Password>
<a:TimeZoneCode>EST</a:TimeZoneCode>
<a:Confirmed>true</a:Confirmed>
<a:Gender>F</a:Gender>
<a:Zip>31562</a:Zip>
<a:HomePhone>7709934216</a:HomePhone>
<a:WorkPhone />
<a:MobileNumber />
<a:FirstName>Bob</a:FirstName>
<a:LastName>TheFireman</a:LastName>
<a:Address1>500 Chastain Blvd</a:Address1>
<a:Address2 />
<a:City>Kennesaw</a:City>
<a:State>GA</a:State>
<a:Country>USA</a:Country>
<a:EmailHTML>true</a:EmailHTML>
<a:NoEmail>false</a:NoEmail>
<a:DOB>1970-01-01</a:DOB>
<a:ShipToConfirmed>false</a:ShipToConfirmed>
<a:WorkAddress1 />
<a:WorkAddress2 />
<a:WorkCity />
<a:WorkState />
<a:WorkZip />
<a:ReferredBy />
<a:PasswordFlag/>
<a:Source />
<a:Subscriptions xmlns:b=”http://www.franklymedia.com/datacontract/SubscriptionInfo”>
<b:SubscriptionInfo>
<b:SubscriptionID>1234</b:SubscriptionID>
<b:OptIn>true</b:OptIn>
</b:SubscriptionInfo>
<b:SubscriptionInfo>
<b:SubscriptionID>5678</b:SubscriptionID>
<b:OptIn>false</b:OptIn>
</b:SubscriptionInfo>
<b:SubscriptionInfo>
<b:SubscriptionID>9101112</b:SubscriptionID>
<b:OptIn>false</b:OptIn>
</b:SubscriptionInfo>
…
…
…
</a:Subscriptions></span>
</member>
<token>6B-2C-68-3B-56-BE-49-03-62-98-01-33-E6-5B-B5-66</token>
<timestamp>20100615161000</timestamp>
</UpdateMember>
Note: Subscriptions XML is optional and can be excluded.
Return value
<SynchResponse xmlns=”http://schemas.datacontract.org/2004/07/ListenerAPI.DataObjects” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>
<Status>FAILED</Status>
<MemberID i:nil=”true”/>
<Message>Call expired</Message>
<StatusCode>500</StatusCode>
</SynchResponse>
Status: “SUCCESS” or “FAILED”
StatusCode: 200, 400 or 500 (200 means no errors, it was successfully processed. 400 means client error, and 500 means system error)
Message: error message
MemberID: will be filled if it was successfully processed. And this is the TL member id you may want to hold on for future use.
Remarks
The member parameter has the following set of attributes. The attributes are listed in the order, in which they are expected to appear when the structure is posted to the API.
Values that are required or used in the generation of the token parameter are highlighted.
- MemberID -Unique ID of the member in the FM database. Required. If the value is set to 0, a new record will be created in the FM database, provided that other values in the object meet all validation requirements
- ExMemberId –Required. Used for the token generation. Unique ID of the member in the partner database. The FM API will create or update the member record depending on the ExMemberID value in the passed-in object. If the value exists in the TL database, the corresponding record will be updated. Otherwise a new member record will be created.
- PartnerCode–Required. Partner identifier issued by Frankly Media
- ExSiteCode–Required. Used for the token generation. Partner’s unique identifier of the site
- UserName–Required. Used for the token generation. Depending on the site setting, the value can be either user-generated or user’s email. See GetStationInfo API
- Email–Required. Used for the token generation.
- Password–Required. Used for the token generation.
- TimeZoneCode-Time Zone Code using one of the following values: ET, CT, PT
- Confirmed-Indicates whether the member has confirmed the email address in the Frankly Media database
- Gender–Required
- Zip–Required. User’s zip/postal code.
- HomePhone -Phone Number in the following format 999-999-9999
- WorkPhone-Phone Number in the following format 999-999-9999
- MobileNumber-Phone Number in the following format 999-999-9999
- FirstName-Required, if last name is specified
- LastName-Required, if first name is specified
- Address1
- Address2
- City
- State
- Country
- EmailHTML-HTML Format in Email only
- NoEmail -Indicates whether the member wants to receive communications from the FM program
- DOB–Required. Members date of birth in the following format: yyyy/mm/dd.
- ShipToConfirmed-Indicates whether the member confirmed the shipping address
- WorkAddress1
- WorkAddress2
- WorkCity
- WorkState
- WorkZip
- ReferredBy
- PasswordFlag – Indicates whether the password has to be updated. When no password is sent, must be set to true
- Source – maximum length: 50 characters
- Subscriptions – (optional) This allows a registration to include information about which subscriptions to opt-in / opt-out of. Contains one or more SubscriptionInfo structures. Each SubscriptionInfo tag contains two sub-tags: SubscriptionID and OptIn. SubscriptionID simply contains the unique identifier for a subscription, while OptIn indicates whether or not to subscribe to that particular item.
Examples
Here is an example of this API call from PHP:
<?php
class cURL {
var $headers;
var $user_agent;
var $compression;
var $cookie_file;
var $proxy;
function cURL($cookies=TRUE,$cookie=’cookies.txt’,$compression=’gzip’,$proxy=”) {
$this->headers[] = ‘Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg’;
$this->headers[] = ‘Connection: Keep-Alive’;
$this->headers[] = ‘Content-type: application/xml;charset=UTF-8’;
$this->user_agent = ‘Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)’;
$this->compression=$compression;
$this->proxy=$proxy;
$this->cookies=$cookies;
if ($this->cookies == TRUE) $this->cookie($cookie);
}
function cookie($cookie_file) {
if (file_exists($cookie_file)) {
$this->cookie_file=$cookie_file;
} else {
fopen($cookie_file,’w’) or $this->error(‘The cookie file could not be opened. Make sure this directory has the correct permissions’);
$this->cookie_file=$cookie_file;
fclose($this->cookie_file);
}
}
function get($url) {
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
//if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
//if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
curl_setopt($process,CURLOPT_ENCODING , $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$return = curl_exec($process);
curl_close($process);
return $return;
}
function post($url,$data) {
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $this->headers);
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERAGENT, $this->user_agent);
if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEFILE, $this->cookie_file);
if ($this->cookies == TRUE) curl_setopt($process, CURLOPT_COOKIEJAR, $this->cookie_file);
curl_setopt($process, CURLOPT_ENCODING , $this->compression);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
if ($this->proxy) curl_setopt($process, CURLOPT_PROXY, $this->proxy);
curl_setopt($process, CURLOPT_POSTFIELDS, $data);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
$return = curl_exec($process);
curl_close($process);
return $return;
}
function error($error) {
echo “<center><div style=’width:500px;border: 3px solid #FFEEFF; padding: 3px; background-color: #FFDDFF;font-family: verdana; font-size: 10px’><b>cURL Error</b><br>$error</div></center>”;
die;
}
}
$cc = new cURL();
$url = ‘https://api.enticent.com/Subscriptions.svc/UpdateMember’;
$param = ‘<UpdateExternalMember xmlns=”http://www.tritonloyalty.com/ISubscriptions” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”><member xmlns:a=”http://www.tritonloyalty.com/datacontract/XinbanClientMemberEx” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”><a:MemberID>0</a:MemberID><a:ExMemberId>12346</a:ExMemberId><a:PartnerCode>CLRCHNL</a:PartnerCode><a:ExSiteCode>DEV4CC</a:ExSiteCode><a:UserName>[email protected]</a:UserName><a:Email>[email protected]</a:Email><a:Password>xyj</a:Password><a:TimeZoneCode>EST</a:TimeZoneCode><a:Confirmed>true</a:Confirmed><a:Gender>F</a:Gender><a:Zip>31562</a:Zip><a:HomePhone>770-993-4216</a:HomePhone><a:WorkPhone>770-993-4215</a:WorkPhone><a:MobileNumber/><a:FirstName>Bob</a:FirstName><a:LastName>TheFireman</a:LastName><a:Address1>500 Chastain Blvd</a:Address1><a:Address2/><a:City>Kennesaw</a:City><a:State>GA</a:State><a:Country>USA</a:Country><a:EmailHTML>true</a:EmailHTML><a:NoEmail>false</a:NoEmail><a:DOB>1970-01-01</a:DOB><a:ShipToConfirmed>false</a:ShipToConfirmed><a:WorkAddress1/><a:WorkAddress2/><a:WorkCity/><a:WorkState/><a:WorkZip/><a:ReferredBy/></member><token>36-0E-2C-F1-CF-86-46-5B-6F-49-E3-DB-F4-8A-0C-70</token><timestamp>20100913203201</timestamp></UpdateExternalMember>’;
echo $cc->post($url, $param);
?>