I'm really trying to avoid making a particular solution more complicated than it needs to be by using a webhook rather than an API to update some lead information that's being transmitted via XML. In this particular case, the structure looks something like
<level1>
<level2>
<level3>
<apple_type>Gala</apple_type>
<orange_type>Navel</orange_type>
</level3>
</level2>
</level1>
Nothing particularly rocket science is attempting to be accomplished here: all I'm trying to do is pull apple_type when orange_type is Navel. Normally with XPath I'd just do something like
/level1/level2/level3[orange_type/text() = "Navel"]/apple_type/text()
However, it doesn't seem like Marketo can use that sort of markup for a response. Because I have multiple potential level3 tags, I can't rely on just turning the query into something that can just look for the order of the tag. Is there any sort of recourse here or am I going to have to make this into a formal API call to place the apple_type data into a field?
Solved! Go to Solution.
Nothing like this can be done with native response processing AFAIK. You could use Apigee (in contrast, AWS APIGW is bad at this) to transform the data if you didn't want to write your own transforming layer, but that might be more trouble than it's worth.
Hi Courtney,
Honestly, if YOU do not know the answer to this, who will ?? I don't.
-Greg
Nothing like this can be done with native response processing AFAIK. You could use Apigee (in contrast, AWS APIGW is bad at this) to transform the data if you didn't want to write your own transforming layer, but that might be more trouble than it's worth.
I think you will have to write your own 'webhook' middle layer to extract appropriate information from the xml.
If you just want to display that information in an email, Velocity scripting might have some XPath functionality you can use.
Rajesh
I actually wound up doing exactly that re:webhook middle layer (all praise to SimpleXML and json_encode!) but the idea of running an XPath selection through Velocity is intriguing—has anyone actually tried this? I'd think it slow the render/send of emails down a ton, but might be interesting in other use cases.
Don't think XmlTool is in the Marketo deployment, is it?
Hey Courtney,
Can you elaborate on what you are using for a middle layer?
I'm considering some python script maybe hosted on Heroku.
SimpleXML is a PHP extension, so.
But note you can do this with an API gateway with no "code" per se and less to maintain. For example, Apigee can set an XML to JSON transform (XML to JSON policy | Apigee Product Documentation).
Sanford is correct that I wrote the middle layer in PHP--in this case, the company had a LAMP stack as their main server and it was the path of least resistance. However, building a similar tool in Python (or just using an API gateway) should be just as easy. It really has more to do with your tech stack than anything else.