{"id":3537,"date":"2013-03-05T10:03:03","date_gmt":"2013-03-05T15:03:03","guid":{"rendered":"http:\/\/ahmeddirie.com\/?p=3537"},"modified":"2013-03-05T10:11:32","modified_gmt":"2013-03-05T15:11:32","slug":"submitting-leads-to-marketos-soap-api-using-php","status":"publish","type":"post","link":"https:\/\/ahmeddirie.com\/blog\/web-development\/submitting-leads-to-marketos-soap-api-using-php\/","title":{"rendered":"Submitting Leads to Marketo&#8217;s SOAP API using PHP"},"content":{"rendered":"<p>With <a href=\"http:\/\/www.marketo.com\" title=\"Marketo - Marketing Automation Software\">Marketo<\/a> updating their SOAP API Endpoint and deprecating support for the existing one as of June 2013, I figured it was high time I did a quick post on posting form leads to Marketo. As a side note, Marketo isn&#8217;t only a lead management tool, but packs an impressive list of tools for marketers. This post however focuses on leads and their API.<\/p>\n<p><!--more--><\/p>\n<h2>The Bare Essentials<\/h2>\n<p>It goes without saying that you&#8217;ve got to already have an account with Marketo and that their script is copied onto your site&#8217;s pages. Quick refresher, it should look something like this.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\ndocument.write(unescape(&quot;%3Cscript src='&quot; + document.location.protocol +\r\n  &quot;\/\/munchkin.marketo.net\/munchkin.js' type='text\/javascript'%3E%3C\/script%3E&quot;));\r\n&lt;\/script&gt;\r\n&lt;script&gt;Munchkin.init('123-ABC-456');&lt;\/script&gt;\r\n<\/pre>\n<p>In a nutshell, the script places a cookie on the user&#8217;s machine and updates Marketo with each page the user visits. It only makes sense to have this on every single page on your site so that you know what the user is checking out.<\/p>\n<p>The ABC-123-456 is a code that Marketo will provide to you. It&#8217;s your customer or account code. Make sure this gets updated so that the tracking information is sent to the right account.<\/p>\n<h2>What&#8217;s Next?<\/h2>\n<p>So, you&#8217;ve got a form filled out and you&#8217;re now ready to start submitting this information to Marketo and attributing all that juicy traffic you&#8217;ve been getting on the site from this anonymous person to an actual lead, or update a known lead.<\/p>\n<p>Before I dive into the nuts and bolts of this, similar to the section on capturing a user&#8217;s form input into an array in the post, <a href=\"http:\/\/ahmeddirie.com\/technology\/web-development\/marketing-automation-integrating-with-pardots-rest-api\/\" title=\"Marketing Automation: Integrating with Pardot\u2019s REST API\">Marketing Automation: Integrating with Pardot\u2019s REST API<\/a>, we&#8217;ll be doing the same thing here. Although, we&#8217;ll be using field names that correspond with Marketo since we have to specify what fields we&#8217;re updating or saving to.<\/p>\n<p>To find out the field names, go to the Admin area of Marketo. In the left navigation page, select Field Management and in the menu just above the content area, you&#8217;ll find Export Field Names. This should give you a csv file with all the fields you have access to.<\/p>\n<h2>User Form &#8211; marketo_form.php<\/h2>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\n\/\/Creating an array to store the values received from user form\r\n$form2Marketo = array();\r\n \r\n\/\/First Name\r\nif (isset($POST['first_name'])) {\r\n\t$form2Marketo['FirstName'] = trim($POST['first_name']);\r\n}\r\n\t\r\n\/\/Last Name\r\nif (isset($POST['last_name'])) {\r\n\t$form2Marketo['LastName'] = trim($POST['last_name']);\r\n}\r\n\r\n\/\/Email\r\nif (isset($POST['email'])) {\r\n\t$form2Marketo['Email'] = trim($POST['email']);\r\n}\r\n\r\n?&gt;\r\n<\/pre>\n<h2>Posting to Marketo &#8211; marketo_post.php<\/h2>\n<p>This is where all the magic happens. After we package the user&#8217;s form data in a beautiful array, we start by checking to see if the user already exists in our Marketo database. We do this because if the user exists, we want to update their record. Otherwise, we&#8217;re dealing with an anonymous user and we&#8217;ll be creating a fresh lead.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\n\/\/Getting the API file and form values files\r\nrequire_once($docroot . &quot;marketo_api.php&quot;);\r\nrequire_once($docroot . &quot;marketo_form.php&quot;);\r\n\r\n$user_id = 'ENTER YOUR USER ID';\r\n$encryption_key = 'ENTER YOUR ENCRYPTION KEY';\r\n$soap_endpoint = 'https:\/\/123-ABC-456.mktoapi.com\/soap\/mktows\/2_0';\r\n\r\n\/\/Connecting to Marketo\r\n$marketo_client = new mktSampleMktowsClient($user_id, $encryption_key, $soap_endpoint);\r\n\r\n\/\/Passing in the user's email address to see if they\r\n\/\/already exist as a lead in Marketo\r\n$checkLead = $marketo_client-&gt;getLead('EMAIL', $form2Marketo['Email']);\r\n\r\n\/\/If the user's email exists in Marketo, grabbing the Lead Record ID so we can \r\n\/\/update this lead with the new form as well as Marketo cookie on their system\r\n\/\/Otherwise, we're creating a new lead.\r\nif (is_object($checkLead)) {\r\n\t$leadRecord = $checkLead-&gt;result-&gt;leadRecordList-&gt;leadRecord;\r\n\t$submitLead = $marketo_client-&gt;syncLead($leadRecord-&gt;Id, $form2Marketo['Email'], $_COOKIE['_mkto_trk'], $form2Marketo);\r\n} else {\r\n\t$submitLead = $marketo_client-&gt;syncLead(&quot;&quot;, $form2Marketo['Email'], $_COOKIE['_mkto_trk'], $form2Marketo);\r\n}\r\n\r\n\/\/Adding the lead to one of our campaigns\r\n$campaignId = 1234;\r\n$marketo_client-&gt;requestCampaign($campaignId, $submitLead-&gt;result-&gt;leadId);\r\n\t\r\n?&gt;\r\n<\/pre>\n<h2>Marketo API &#8211; marketo_api.php<\/h2>\n<p>This file is the standard Marketo SOAP PHP Client example that you get from Marketo. Although, this one is a little tighter and removes some of the extra example code they provide. Just make sure to update your timezone. The one below has the timezone set to America\/Toronto.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\n\tclass mktSampleMktowsClient {\r\n\t\tconst CLIENT_TZ = 'America\/Toronto';\r\n\t\tconst MKTOWS_NAMESPACE = 'http:\/\/www.marketo.com\/mktows\/';\r\n\t\tprotected $accessKey;\r\n\t\tprotected $secretKey;\r\n\t\tprotected $soapClient;\r\n\t\t\r\n\t\tpublic function __construct($accessKey, $secretKey, $soapEndPoint) {\r\n\t\t\t$this-&gt;accessKey = $accessKey;\r\n\t\t\t$this-&gt;secretKey = $secretKey;\r\n\t\t\t$options = array(&quot;trace&quot; =&gt; true, &quot;connection_timeout&quot; =&gt; 20, &quot;location&quot; =&gt; $soapEndPoint);\r\n\t\t\t$wsdlUri = $soapEndPoint . '?WSDL';\r\n\t\t\t$this-&gt;soapClient = new SoapClient($wsdlUri, $options);\r\n\t\t}\r\n\t\tstatic public function newAttribute($name, $value) {\r\n\t\t\t$attr = new Attribute();\r\n\t\t\t$attr-&gt;attrName = $name;\r\n\t\t\t$attr-&gt;attrValue = $value;\r\n\t\t\treturn $attr;\r\n\t\t}\r\n\t\tprivate function _getAuthenticationHeader($paramName) {\r\n\t\t\t$dtzObj = new DateTimeZone(self::CLIENT_TZ);\r\n\t\t\t$dtObj = new DateTime('now', $dtzObj);\r\n\t\t\t$timestamp = $dtObj-&gt;format(DATE_W3C);\r\n\t\t\t$encryptString = $timestamp . $this-&gt;accessKey;\r\n\t\t\t$signature = hash_hmac('sha1', $encryptString, $this-&gt;secretKey);\r\n\t\t\t$attrs = new stdClass();\r\n\t\t\t$attrs-&gt;mktowsUserId  = $this-&gt;accessKey;\r\n\t\t\t$attrs-&gt;requestSignature = $signature;\r\n\t\t\t$attrs-&gt;requestTimestamp = $timestamp;\r\n\t\t\t$soapHdr = new SoapHeader(self::MKTOWS_NAMESPACE, 'AuthenticationHeader', $attrs);\r\n\t\t\treturn $soapHdr;\r\n\t\t}\r\n\t\tpublic function getLead($keyType, $keyValue) {\r\n\t\t\t$success = false;\r\n\t\t\t$leadKey = new LeadKey();\r\n\t\t\t$leadKey-&gt;keyType = $keyType;\r\n\t\t\t$leadKey-&gt;keyValue = $keyValue;\r\n\t\t\t$params = new paramsGetLead();\r\n\t\t\t$params-&gt;leadKey = $leadKey;\r\n\t\t\t$options = array();\r\n\t\t\t$authHdr = $this-&gt;_getAuthenticationHeader('paramsGetLead');\r\n\t\t\ttry {\r\n\t\t\t\t$success = $this-&gt;soapClient-&gt;__soapCall('getLead', array($params), $options, $authHdr);\r\n\t\t\t\t$resp = $this-&gt;soapClient-&gt;__getLastResponse();\r\n\t\t\t}\r\n\t\t\tcatch (SoapFault $ex) {\r\n\t\t\t\t$ok = false;\r\n\t\t\t\t$errCode = 1;\r\n\t\t\t\t$faultCode = null;\r\n\t\t\t\tif (!empty($ex-&gt;detail-&gt;serviceException-&gt;code)) { $errCode = $ex-&gt;detail-&gt;serviceException-&gt;code; }\r\n\t\t\t\tif (!empty($ex-&gt;faultCode)) { $faultCode = $ex-&gt;faultCode; }\r\n\t\t\t\tswitch ($errCode) {\r\n\t\t\t\t\tcase mktWsError::ERR_LEAD_NOT_FOUND:\r\n\t\t\t\t\t$ok = true;\r\n\t\t\t\t\t$success = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t}\r\n\t\t\t\tif (!$ok) {\r\n\t\t\t\t\tif ($faultCode != null) {\r\n\t\t\t\t\t\tif (strpos($faultCode, 'Client')) {\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse if (strpos($faultCode, 'Server')) {\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (Exception $ex) {\r\n\t\t\t\t$msg = $ex-&gt;getMessage();\r\n\t\t\t\t$req = $this-&gt;soapClient-&gt;__getLastRequest();\r\n\t\t\t\tvar_dump($ex);\r\n\t\t\t\texit(1);\r\n\t\t\t}\r\n\t\t\treturn $success;\r\n\t\t}\r\n\t  \r\n\t\tpublic function syncLead($leadId, $email, $marketoCookie, $attrs) {\r\n\t\t\t$attrArray = array();\r\n\t\t\tforeach ($attrs as $attrName =&gt; $attrValue) {\r\n\t\t\t\t$a = new Attribute();\r\n\t\t\t\t$a-&gt;attrName = $attrName;\r\n\t\t\t\t$a-&gt;attrValue = $attrValue;\r\n\t\t\t\t$attrArray[] = $a;\r\n\t\t\t}\r\n\t\t\t$aryOfAttr = new ArrayOfAttribute();\r\n\t\t\t$aryOfAttr-&gt;attribute = $attrArray;\r\n\t\t\t$leadRec = new LeadRecord();\r\n\t\t\t$leadRec-&gt;leadAttributeList = $aryOfAttr;\r\n\t\t\tif (!empty($leadId)) { $leadRec-&gt;Id = $leadId; } \r\n\t\t\tif (!empty($email)) { $leadRec-&gt;Email = $email; }\r\n\t\t\t$params = new paramsSyncLead();\r\n\t\t\t$params-&gt;leadRecord = $leadRec;\r\n\t\t\t$params-&gt;returnLead = true;\r\n\t\t\t$params-&gt;marketoCookie = $marketoCookie;\r\n\t\t\t$options = array();\r\n\t\t\t$authHdr = $this-&gt;_getAuthenticationHeader('paramsSyncLead');\r\n\t\t\ttry {\r\n\t\t\t\t$success = $this-&gt;soapClient-&gt;__soapCall('syncLead', array($params), $options, $authHdr);\r\n\t\t\t\t$resp = $this-&gt;soapClient-&gt;__getLastResponse();\r\n\t\t\t}\r\n\t\t\tcatch (SoapFault $ex) {\r\n\t\t\t\t$ok = false;\r\n\t\t\t\t$errCode = 1;\r\n\t\t\t\t$faultCode == null;\r\n\t\t\t\tif (!empty($ex-&gt;detail-&gt;serviceException-&gt;code)) { $errCode = $ex-&gt;detail-&gt;serviceException-&gt;code; }\r\n\t\t\t\tif (!empty($ex-&gt;faultCode)) { $faultCode = $ex-&gt;faultCode; }\r\n\t\t\t\tswitch ($errCode) {\t\r\n\t\t\t\t\tcase mktWsError::ERR_LEAD_SYNC_FAILED: \r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t}\r\n\t\t\t\tif (!$ok) {\r\n\t\t\t\t\tif ($faultCode != null) {\r\n\t\t\t\t\t\tif (strpos($faultCode, 'Client')) {\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse if (strpos($faultCode, 'Server')) {\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (Exception $ex) {\r\n\t\t\t\t$msg = $ex-&gt;getMessage();\r\n\t\t\t\t$req = $this-&gt;soapClient-&gt;__getLastRequest();\r\n\t\t\t\tvar_dump($ex);\r\n\t\t\t\texit(1);\r\n\t\t\t}\r\n\t\t\treturn $success;\r\n\t\t}\r\n\t\t\r\n\t\tpublic function requestCampaign($campId, $leadEmail)\r\n\t\t{\r\n\t\t  $retStat = false;\r\n\t\t  \r\n\t\t  $leadKey = new LeadKey();\r\n\t\t  $leadKey-&gt;keyType = 'IDNUM';\r\n\t\t  $leadKey-&gt;keyValue = $leadEmail;\r\n\t\t  \r\n\t\t  $leadList = new ArrayOfLeadKey();\r\n\t\t  $leadList-&gt;leadKey = array($leadKey);\r\n\t\t  \r\n\t\t  $params = new paramsRequestCampaign();\r\n\t\t  $params-&gt;campaignId = $campId;\r\n\t\t  $params-&gt;leadList = $leadList;\r\n\t\t  $params-&gt;source = 'MKTOWS';\r\n\t  \r\n\t\t  $authHdr = $this-&gt;_getAuthenticationHeader('paramsRequestCampaign');\r\n\t\t  \r\n\t\t  try {\r\n\t\t\t$success = $this-&gt;soapClient-&gt;__soapCall('requestCampaign', array($params), $options, $authHdr);\r\n\t\t\t\r\n\t\t\tif (isset($success-&gt;result-&gt;success)) {\r\n\t\t\t  $retStat = $success-&gt;result-&gt;success;\r\n\t\t\t}\r\n\t\t  }\r\n\t\t  catch (SoapFault $ex) {\r\n\t\t\t$ok = false;\r\n\t\t\t$errCode = !empty($ex-&gt;detail-&gt;serviceException-&gt;code)? $ex-&gt;detail-&gt;serviceException-&gt;code : 1;\r\n\t\t\t$faultCode = !empty($ex-&gt;faultCode) ? $ex-&gt;faultCode : null;\r\n\t\t\tswitch ($errCode)\r\n\t\t\t{\r\n\t\t\t  case mktWsError::ERR_LEAD_NOT_FOUND:\r\n\t\t\t\t\/\/ Handle error for campaign not found\r\n\t\t\t\tbreak;\r\n\t\t\t  default:\r\n\t\t\t\t\/\/ Handle other errors\r\n\t\t\t}\r\n\t\t\tif (!$ok) {\r\n\t\t\t  if ($faultCode != null) {\r\n\t\t\t\tif (strpos($faultCode, 'Client')) {\r\n\t\t\t\t  \/\/ This is a client error.  Check the other codes and handle.\r\n\t\t\t\t} else if (strpos($faultCode, 'Server')) {\r\n\t\t\t\t  \/\/ This is a server error.  Call Marketo support with details.\r\n\t\t\t\t} else {\r\n\t\t\t\t  \/\/ W3C spec has changed :)\r\n\t\t\t\t  \/\/ But seriously, Call Marketo support with details.\r\n\t\t\t\t}\r\n\t\t\t  } else {\r\n\t\t\t\t\/\/ Not a good place to be.\r\n\t\t\t  }\r\n\t\t\t}\r\n\t\t  }\r\n\t\t  catch (Exception $ex) {\r\n\t\t\t$msg = $ex-&gt;getMessage();\r\n\t\t\t$req = $this-&gt;soapClient-&gt;__getLastRequest();\r\n\t\t\techo &quot;Error occurred for request: $msg\\n$req\\n&quot;;\r\n\t\t\tvar_dump($ex);\r\n\t\t\texit(1);\r\n\t\t  }\r\n\t\t  return $retStat;\r\n\t\t}\r\n\r\n\t}\r\n\t  \r\n\tclass mktWsError {\r\n\t\tconst ERR_SEVERE_INTERNAL_ERROR = 10001;\r\n\t\tconst ERR_INTERNAL_ERROR = 20011;\r\n\t\tconst ERR_REQUEST_NOT_UNDERSTOOD = 20012;\r\n\t\tconst ERR_ACCESS_DENIED = 20013;\r\n\t\tconst ERR_AUTH_FAILED = 20014;\r\n\t\tconst ERR_REQUEST_LIMIT_EXCEEDED = 20015;\r\n\t\tconst ERR_REQ_EXPIRED = 20016;\r\n\t\tconst ERR_INVALID_REQ = 20017;\r\n\t\tconst ERR_LEAD_KEY_REQ = 20101;\r\n\t\tconst ERR_LEAD_KEY_BAD = 20102;\r\n\t\tconst ERR_LEAD_NOT_FOUND = 20103;\r\n\t\tconst ERR_LEAD_DETAIL_REQ = 20104;\r\n\t\tconst ERR_LEAD_ATTRIB_BAD = 20105;\r\n\t\tconst ERR_LEAD_SYNC_FAILED = 20106;\r\n\t\tconst ERR_PARAMETER_REQ = 20109;\r\n\t\tconst ERR_PARAMETER_BAD = 20110;\r\n\t}\r\n\t  \r\n\tclass ActivityRecord { \r\n\t\tpublic $id;\r\n\t\tpublic $activityDateTime;\r\n\t\tpublic $activityType;\r\n\t\tpublic $mktgAssetName;\r\n\t\tpublic $activityAttributes;\r\n\t\tpublic $campaign;\r\n\t\tpublic $personName;\r\n\t\tpublic $mktPersonId;\r\n\t\tpublic $foreignSysId;\r\n\t\tpublic $orgName;\r\n\t\tpublic $foreignSysOrgId;\r\n\t}\r\n\tclass ActivityTypeFilter {\r\n\t\tpublic $includeTypes;\r\n\t\tpublic $excludeTypes;\r\n\t}\r\n\tclass Attribute {\r\n\t\tpublic $attrName;\r\n\t\tpublic $attrType;\r\n\t\tpublic $attrValue;\r\n\t}\r\n\tclass AuthenticationHeaderInfo {\r\n\t\tpublic $mktowsUserId;\r\n\t\tpublic $requestSignature;\r\n\t\tpublic $requestTimestamp;\r\n\t\tpublic $audit;\r\n\t\tpublic $mode;\r\n\t}\r\n\tclass CampaignRecord {\r\n\t\tpublic $id;\r\n\t\tpublic $name;\r\n\t\tpublic $description;\r\n\t}\r\n\tclass LeadActivityList {\r\n\t\tpublic $returnCount;\r\n\t\tpublic $remainingCount;\r\n\t\tpublic $newStartPosition;\r\n\t\tpublic $activityRecordList;\r\n\t}\r\n\tclass LeadChangeRecord {\r\n\t\tpublic $id;\r\n\t\tpublic $activityDateTime;\r\n\t\tpublic $activityType;\r\n\t\tpublic $mktgAssetName;\r\n\t\tpublic $activityAttributes;\r\n\t\tpublic $campaign;\r\n\t\tpublic $mktPersonId;\r\n\t}\r\n\tclass LeadKey {\r\n\t\tpublic $keyType;\r\n\t\tpublic $keyValue;\r\n\t}\r\n\tclass LeadRecord {\r\n\t\tpublic $Id;\r\n\t\tpublic $Email;\r\n\t\tpublic $leadAttributeList;\r\n\t}\r\n\tclass LeadStatus {\r\n\t\tpublic $leadKey;\r\n\t\tpublic $status;\r\n\t}\r\n\tclass ListKey {\r\n\t\tpublic $keyType;\r\n\t\tpublic $keyValue;\r\n\t}\r\n\tclass ResultGetCampaignsForSource {\r\n\t\tpublic $returnCount;\r\n\t\tpublic $campaignRecordList;\r\n\t}\r\n\tclass ResultGetLead {\r\n\t\tpublic $count;\r\n\t\tpublic $leadRecordList;\r\n\t}\r\n\tclass ResultGetLeadChanges {\r\n\t\tpublic $returnCount;\r\n\t\tpublic $remainingCount;\r\n\t\tpublic $newStartPosition;\r\n\t\tpublic $leadChangeRecordList;\r\n\t}\r\n\tclass ResultListOperation {\r\n\t\tpublic $success;\r\n\t\tpublic $statusList;\r\n\t}\r\n\tclass ResultRequestCampaign {\r\n\t\tpublic $success;\r\n\t}\r\n\tclass ResultSyncLead {\r\n\t\tpublic $leadId;\r\n\t\tpublic $syncStatus;\r\n\t\tpublic $leadRecord;\r\n\t}\r\n\tclass StreamPosition {\r\n\t\tpublic $latestCreatedAt;\r\n\t\tpublic $oldestCreatedAt;\r\n\t\tpublic $activityCreatedAt;\r\n\t\tpublic $offset;\r\n\t}\r\n\tclass ArrayOfActivityRecord {\r\n\t\tpublic $activityRecord;\r\n\t}\r\n\tclass ArrayOfActivityType {\r\n\t\tpublic $activityType;\r\n\t}\r\n\tclass ArrayOfAttribute {\r\n\t\tpublic $attribute;\r\n\t}\r\n\tclass ArrayOfBase64Binary {\r\n\t\tpublic $base64Binary;\r\n\t\tpublic $base64Binary_encoded;\r\n\t}\r\n\tclass ArrayOfCampaignRecord {\r\n\t\tpublic $campaignRecord;\r\n\t}\r\n\tclass ArrayOfLeadChangeRecord {\r\n\t\tpublic $leadChangeRecord;\r\n\t}\r\n\tclass ArrayOfLeadKey {\r\n\t\tpublic $leadKey;\r\n\t}\r\n\tclass ArrayOfLeadRecord {\r\n\t\tpublic $leadRecord;\r\n\t}\r\n\tclass ArrayOfLeadStatus {\r\n\t\tpublic $leadStatus;\r\n\t}\r\n\tclass paramsGetCampaignsForSource {\r\n\t\tpublic $source;\r\n\t\tpublic $name;\r\n\t\tpublic $exactName;\r\n\t}\r\n\tclass paramsGetLead {\r\n\t\tpublic $leadKey;\r\n\t}\r\n\tclass paramsGetLeadActivity {\r\n\t\tpublic $leadKey;\r\n\t\tpublic $activityFilter;\r\n\t\tpublic $startPosition;\r\n\t\tpublic $batchSize;\r\n\t}\r\n\tclass paramsGetLeadChanges {\r\n\t\tpublic $startPosition;\r\n\t\tpublic $activityFilter;\r\n\t\tpublic $batchSize;\r\n\t}\r\n\tclass paramsListOperation {\r\n\t\tpublic $listOperation;\r\n\t\tpublic $listKey;\r\n\t\tpublic $listMemberList;\r\n\t\tpublic $strict;\r\n\t}\r\n\tclass paramsRequestCampaign {\r\n\t\tpublic $source; public $campaignId; public $leadList; \r\n\t}\r\n\tclass paramsSyncLead { public $leadRecord; public $returnLead; public $marketoCookie; }\r\n\tclass successGetCampaignsForSource { public $result; }\r\n\tclass successGetLead { public $result; }\r\n\tclass successGetLeadActivity { public $leadActivityList; }\r\n\tclass successGetLeadChanges { public $result; }\r\n\tclass successListOperation { public $result; }\r\n\tclass successRequestCampaign { public $result; }\r\n\tclass successSyncLead { public $result; }\r\n\tclass MktowsXmlSchema {\r\n\t\tstatic public\r\n\t\t$class_map = array(\r\n\t\t\t&quot;ActivityRecord&quot; =&gt; &quot;ActivityRecord&quot;,\r\n\t\t\t&quot;ActivityTypeFilter&quot; =&gt; &quot;ActivityTypeFilter&quot;,\r\n\t\t\t&quot;Attribute&quot; =&gt; &quot;Attribute&quot;,\r\n\t\t\t&quot;AuthenticationHeaderInfo&quot; =&gt; &quot;AuthenticationHeaderInfo&quot;,\r\n\t\t\t&quot;CampaignRecord&quot; =&gt; &quot;CampaignRecord&quot;,\r\n\t\t\t&quot;LeadActivityList&quot; =&gt; &quot;LeadActivityList&quot;,\r\n\t\t\t&quot;LeadChangeRecord&quot; =&gt; &quot;LeadChangeRecord&quot;,\r\n\t\t\t&quot;LeadKey&quot; =&gt; &quot;LeadKey&quot;,\r\n\t\t\t&quot;LeadRecord&quot; =&gt; &quot;LeadRecord&quot;,\r\n\t\t\t&quot;LeadStatus&quot; =&gt; &quot;LeadStatus&quot;,\r\n\t\t\t&quot;ListKey&quot; =&gt; &quot;ListKey&quot;,\r\n\t\t\t&quot;ResultGetCampaignsForSource&quot; =&gt; &quot;ResultGetCampaignsForSource&quot;,\r\n\t\t\t&quot;ResultGetLead&quot; =&gt; &quot;ResultGetLead&quot;,\r\n\t\t\t&quot;ResultGetLeadChanges&quot; =&gt; &quot;ResultGetLeadChanges&quot;,\r\n\t\t\t&quot;ResultListOperation&quot; =&gt; &quot;ResultListOperation&quot;,\r\n\t\t\t&quot;ResultRequestCampaign&quot; =&gt; &quot;ResultRequestCampaign&quot;,\r\n\t\t\t&quot;ResultSyncLead&quot; =&gt; &quot;ResultSyncLead&quot;,\r\n\t\t\t&quot;StreamPosition&quot; =&gt; &quot;StreamPosition&quot;,\r\n\t\t\t&quot;ArrayOfActivityRecord&quot; =&gt; &quot;ArrayOfActivityRecord&quot;,\r\n\t\t\t&quot;ArrayOfActivityType&quot; =&gt; &quot;ArrayOfActivityType&quot;,\r\n\t\t\t&quot;ArrayOfAttribute&quot; =&gt; &quot;ArrayOfAttribute&quot;,\r\n\t\t\t&quot;ArrayOfBase64Binary&quot; =&gt; &quot;ArrayOfBase64Binary&quot;,\r\n\t\t\t&quot;ArrayOfCampaignRecord&quot; =&gt; &quot;ArrayOfCampaignRecord&quot;,\r\n\t\t\t&quot;ArrayOfLeadChangeRecord&quot; =&gt; &quot;ArrayOfLeadChangeRecord&quot;,\r\n\t\t\t&quot;ArrayOfLeadKey&quot; =&gt; &quot;ArrayOfLeadKey&quot;,\r\n\t\t\t&quot;ArrayOfLeadRecord&quot; =&gt; &quot;ArrayOfLeadRecord&quot;,\r\n\t\t\t&quot;ArrayOfLeadStatus&quot; =&gt; &quot;ArrayOfLeadStatus&quot;,\r\n\t\t\t&quot;paramsGetCampaignsForSource&quot; =&gt; &quot;paramsGetCampaignsForSource&quot;,\r\n\t\t\t&quot;paramsGetLead&quot; =&gt; &quot;paramsGetLead&quot;,\r\n\t\t\t&quot;paramsGetLeadActivity&quot; =&gt; &quot;paramsGetLeadActivity&quot;,\r\n\t\t\t&quot;paramsGetLeadChanges&quot; =&gt; &quot;paramsGetLeadChanges&quot;,\r\n\t\t\t&quot;paramsListOperation&quot; =&gt; &quot;paramsListOperation&quot;,\r\n\t\t\t&quot;paramsRequestCampaign&quot; =&gt; &quot;paramsRequestCampaign&quot;,\r\n\t\t\t&quot;paramsSyncLead&quot; =&gt; &quot;paramsSyncLead&quot;,\r\n\t\t\t&quot;successGetCampaignsForSource&quot; =&gt; &quot;successGetCampaignsForSource&quot;,\r\n\t\t\t&quot;successGetLead&quot; =&gt; &quot;successGetLead&quot;,\r\n\t\t\t&quot;successGetLeadActivity&quot; =&gt; &quot;successGetLeadActivity&quot;,\r\n\t\t\t&quot;successGetLeadChanges&quot; =&gt; &quot;successGetLeadChanges&quot;,\r\n\t\t\t&quot;successListOperation&quot; =&gt; &quot;successListOperation&quot;,\r\n\t\t\t&quot;successRequestCampaign&quot; =&gt; &quot;successRequestCampaign&quot;,\r\n\t\t\t&quot;successSyncLead&quot; =&gt; &quot;successSyncLead&quot;);\r\n\t}\r\n\r\n?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With Marketo updating their SOAP API Endpoint and deprecating support for the existing one as of June 2013, I figured it was high time I did a quick post on posting form leads to Marketo. As a side note, Marketo isn&#8217;t only a lead management tool, but packs an impressive list of tools for marketers. This post however focuses on leads and their API.<\/p>\n","protected":false},"author":2,"featured_media":3565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[288,388,391,415,22,331],"_links":{"self":[{"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/posts\/3537"}],"collection":[{"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/comments?post=3537"}],"version-history":[{"count":28,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/posts\/3537\/revisions"}],"predecessor-version":[{"id":3567,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/posts\/3537\/revisions\/3567"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/media\/3565"}],"wp:attachment":[{"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/media?parent=3537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/categories?post=3537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahmeddirie.com\/blog\/wp-json\/wp\/v2\/tags?post=3537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}