Using https://github.com/PunchTab/suds-marketo/ library to access the SOAP api, I am able to pull in a lead:
import suds_marketo
client = suds_marketo.Client(soap_endpoint=endpoint, user_id=id_, encryption_key=key)
client.get_lead('j...rs@ud...y.com')
And, awesome, I get my marketo record back. So, authentication is working.
When I try to create a custom object, following the example in the docs (http://developers.marketo.com/documentation/soap/synccustomobjects/):
cust_obj = client.CustomObj
att = client.Attribute
att.attrName = 'MKTOID'
att.attrValue = '1090177'
cust_obj.customObjKeyList.attribute.append(att)
att = client.Attribute
att.attrName = 'rid'
att.attrValue = 'rid1'
cust_obj.customObjKeyList.attribute.append(att)
att = client.Attribute
att.attrName = 'city'
att.attrValue = 'SanMateo'
cust_obj.customObjAttributeList.attribute.append(att)
co = client.ArrayOfCustomObj
co.customObj.append(cust_obj)
I get an error:
ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.marketo.com/mktows/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.marketo.com/mktows/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<tns:AuthenticationHeader>
<mktowsUserId>...</mktowsUserId>
<requestSignature>...</requestSignature>
<requestTimestamp>2014-11-03T05:50:06Z</requestTimestamp>
</tns:AuthenticationHeader>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:paramsSyncCustomObjects>
<objTypeName>ROADSHOW</objTypeName>
<customObjList>
<customObj>
<customObjKeyList>
<attribute>
<attrName>MKTOID</attrName>
<attrValue>1090177</attrValue>
</attribute>
<attribute>
<attrName>rid</attrName>
<attrValue>rid1</attrValue>
</attribute>
</customObjKeyList>
<customObjAttributeList>
<attribute>
<attrName>city</attrName>
<attrValue>SanMateo</attrValue>
</attribute>
</customObjAttributeList>
</customObj>
</customObjList>
<operation>INSERT</operation>
</ns0:paramsSyncCustomObjects>
</ns1:Body>
</SOAP-ENV:Envelope>
WebFault: Server raised fault: '20110 - Input error'
When I look at the example given in the docs:
- <?xml version="1.0" encoding="UTF-8"?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/">
- <SOAP-ENV:Header>
- <ns1:AuthenticationHeader>
- <mktowsUserId>demo17_1_809934544BFABAE58E5D27</mktowsUserId>
- <requestSignature>ca67d597ced5bfce7f638e96204d6e1f38d3ffe7</requestSignature>
- <requestTimestamp>2013-08-20T10:26:07-07:00</requestTimestamp>
- </ns1:AuthenticationHeader>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <ns1:paramsSyncCustomObjects>
- <objTypeName>RoadShow</objTypeName>
- <customObjList>
- <customObj>
- <customObjKeyList>
- <attribute>
- <attrName>MKTOID</attrName>
- <attrValue>1090177</attrValue>
- </attribute>
- <attribute>
- <attrName>rid</attrName>
- <attrValue>rid1</attrValue>
- </attribute>
- </customObjKeyList>
- <customObjAttributeList>
- <attribute>
- <attrName>city</attrName>
- <attrValue>SanMateo</attrValue>
- </attribute>
- <attribute>
- <attrName>zip</attrName>
- <attrValue>94404</attrValue>
- </attribute>
- <attribute>
- <attrName>state</attrName>
- <attrValue>California</attrValue>
- </attribute>
- </customObjAttributeList>
- </customObj>
- </customObjList>
- <operation>UPSERT</operation>
- </ns1:paramsSyncCustomObjects>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
I don't see any difference. Am I missing something? What am I doing wrong?