2 Replies Latest reply on Feb 15, 2013 6:20 AM by 30141

    How do I get a list of Lead Fieldnames using the API?

      Hi there,

      I am stuck trying to get a list of lead fieldnames (Firstname, lastname, salutation, company etc.) using the API and the discussions about this topic only talked about geting a list of field names using the UI. 

      Any ideas on how to do this? 

      I have tried using the ParamsGetMObjects but using the paramsGetMObjects type = "Field" or "Fields" gave errors saying that "MObject type is unknown".

      Here is the piece of code I am working with: 

                       Marketo_WS_2_0.ParamsGetMObjects pgo = new Marketo_WS_2_0.ParamsGetMObjects();
                       Marketo_WS_2_0.MObjCriteria moc = new Marketo_WS_2_0.MObjCriteria();
                       moc.attrName = "*";
                       pgo.mObjCriteriaList = new Marketo_WS_2_0.MObjCriteria[1];
                       pgo.mObjCriteriaList[0] = moc;
                       pgo.type = "Field"; 
                       var resp = client.getMObjects(ws_header, pgo);

           Thank you.
        • Re: How do I get a list of Lead Fieldnames using the API?
          You can use the DescribeMObject API call to get back the list of API Fields.  Specify LeadRecord as the objectName.

          Here is a sample REQUEST/RESPONSE XML

          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mkt="http://www.marketo.com/mktows/">

          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.marketo.com/mktows/">
                         <description>Composite object composed of fields from Lead, LeadInterest, and Company</description>
                               <description xsi:nil="true"/>
                               <displayName>Email Address</displayName>
                               <isName xsi:nil="true"/>
                               <dynamicFieldRef xsi:nil="true"/>



          • Re: How do I get a list of Lead Fieldnames using the API?
            Thank you! That does the trick.