How to create Custom Field Using API

I am trying to create Custom Field Using API
then getting this result [InvalidParameter]The group id “1” is an invalid header for Contact
I provided the below fields
privatekey
customFieldType
displayName
dataType
headerID

In this headerID which value should i send ?

how can i solve it

The header Id should be the id found on the custom field page under the custom tab. The easiest way to get this Id is to inspect that element on that page. You will see something similar to what is below.
<a href="javascript:editGroup('22')">Edit</a>
You can see in this example that the Id for my group is 22.
Here is a link to the custom fields documentation https://classic-infusionsoft.knowledgeowl.com/help/create-custom-fields

I want create custom field on User side through API

I want create custom fields on User Side when they provide API
how is it possible to create custom fields on user side with clearing Header Id issue ?

Compo

I’m sorry Srini,
I’m not sure that I fully understand what exactly you are attempting to accomplish. If you could provide some more context to what you are trying to accomplish I will do my best to prove you with a solution.

When any user provide InfusionSoft API and APPName in my app
then i create the CustomFields for Contacts in their InfusionSoft Account
while i am trying to create the CustomFields in their account with the
privateKey means APIkey
customFieldType —> Contact
displayName —> AuditURL
dataType —> Text
headerID —> 1
then getting the below headerID issue
[InvalidParameter]The group id “1” is an invalid header for Contact
if CustomFields are created sucessfully then i Create the contacts with CustomField values

Hi Srini,

As mentioned in my previous post. You need to set the header Id to a value that is already created in the application. If you have access to the contacts custom field page in an application you can inspect the header link. This will provide you with an id. For example
<a href="javascript:editGroup('22')">Edit</a>
Here you can see the Id is 22.

If you are looking for this information via the API you would need to query the Data Form Group table for a list of valid Ids that you can set. You would use the DataService.Query to get this data.

Can you please provide sample code to pass the values for the DataService.Query

Hey Srini,
I’m sorry I don’t have sample code immediately available however, you can see the request and information you’d need to send in order to get the information you need with this documentation. Query the table - https://developer.infusionsoft.com/docs/xml-rpc/#data-query-a-data-table
The table schema - https://developer.infusionsoft.com/docs/table-schema/#DataFormGroup

Hi Sterling,
While trying to get headerId
running the Dataservice Query I But i am getting empty Response
Below values are passing for the query
privateKey -----> XXXXXXXXXXXXXX
tableName -----> DataFormGroup
limit ------> 1000
page ------> 0
queryField ------>TabId
Query ------>FirstName
returnField1 ------>TabId
returnField2 ------>Name
orderBy ------> TabId
ascending -----> 1

Can you please tell me where i am doing wrong to get HeaderId ?
for above values getting empty results

Hey Srini,
If you are not getting an error it may be that you don’t have any values in that table. You could go into the application and create the records though the UI. If this is not an option you’d need to create it via the api. The DataService.add is a way that you can write to the tables needed in order to create the required data needed to create the custom fields. Custom fields have dependencies on the HeaderId and the HeaderId has a dependency on TabId. So, you would need to first add a record to DataFormTab. Then reference the TabId returned adding a record to DataFormGroup. Then use the returned HeaderId to make your final call using DataService.addCustomField

Hey @Sterling,
Ok, I’m following your steps but I get this error [NoTableAccess]Access denied to table DataFormTab
for the first step. And your link also says that this table has only Read Access for API. The same things for DataFormGroup table. How can we add a record to these tables?
Best regards!