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.


(Venkatesan Rajendiran) #4

HI

I was trying to get the list of custom fields using POST man. For this i have used the below endpoint but it is throwing error. Can you please help on this?

https://api.infusionsoft.com/crm/rest/v1/DataFormField?access_token=8ggud8t4m8jf4bbwvfd4zrc4&FormId=-1


(Nicholas Trecina) #5

Hi @Venkatesan_Rajendira, the request above is for the XML-RPC API which is completely separate from the REST API. In order to get contact custom fields via REST, you would make a call GET https://api.infusionsoft.com/crm/rest/v1/contacts/model. You can find more details about the REST endpoint here.


(Venkatesan Rajendiran) #6

Thank you @Nicholas_Trecina it is working fine as expected. Is there any API call to get the standard fields of tables.?


(Nicholas Trecina) #7

We don’t have an endpoint that will return the list of standard properties. You can refer to the API docs to find out what is available.


(John Borelli) #8

There isn’t a list yet for REST (still being developed) but the RPC model references the following:
https://developer.infusionsoft.com/docs/table-schema/

The REST model uses different naming for its returns but no descriptive list is yet available for those.


(Venkatesan Rajendiran) #9

Thank you @Nicholas_Trecina @John_Borelli for your help.