Custom fields list endpoint


(Lukasz Maslej) #1

Hi,

I would have a question concerning custom fields. I found in xml-rpc api docs enpoints to create/update custom fields. Is there also some way to fetch the list of custom fields for selected resource type like contact/company by xml-rpc api?

Best
Lukas


(John Borelli) #2

Hi @Lukasz_Maslej,

you can use the Query method on the DataFormField table to query for custom field information. Using the FormId field for query you can segment by what table, the fields for contacts. Table schema can be referenced here:

https://developer.infusionsoft.com/docs/table-schema/


(Nicholas Trecina) #3

Hi @Lukasz_Maslej, here is an example XML-RPC request that will give you the Id, Name, Label, and DataType fields for all contact custom fields.

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>DataService.query</methodName>
  <params>
    <param>
      <value><string>{{privateKey}}</string></value>
    </param>
    <param>
      <value><string>DataFormField</string></value>
    </param>
    <param>
      <value><int>100</int></value>
    </param>
    <param>
      <value><int>0</int></value>
    </param>
    <param>
      <value>
        <struct>
          <member>
            <name>FormId</name>
            <value><int>-1</int></value>
          </member>
        </struct>
      </value>
    </param>
    <param>
      <value>
        <array>
          <data>
            <value><string>Id</string></value>
            <value><string>Name</string></value>
            <value><string>Label</string></value>
            <value><string>DataType</string></value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodCall>

If you wanted to return company custom fields instead, you would replace the FormId parameter value of -1 with -6. See the Table Schema Documentation for the full list of FormId values under the DataFormField section.