Creating source_type for create contact field

Hi,

I’m using the “Try API” functionality from the docs.
When using the create or update contact api call, I’m getting an invalid value for my source_type. I’m trying to create the source type in my sandbox CRM. I looked in the general documentation, and it seemed that this corresponded to a Lead Source. I created a lead source there (it shows up in the Lead Source drop-down now if I do the manual create a contact through the CRM site). However, when I try to pass the source_type through the API, using the same value (in this case “HEARKEN”), it returns

{
  "message": "Input value is invalid: HEARKEN"
}

On the Lead Source record, I made “HEARKEN” the value for Name, Category and Medium in the hopes that it was one of them. Here’s the JSON I’m sending.

{"source_type":"HEARKEN","duplicate_option":"Email","given_name":"corey","family_name":"","email_addresses":[{"email":"coreyhaines@example.com","field":"EMAIL1"}],"opt_in_reason":"Opted out of form","tags":[]}

Thanks!

Try replacing ‘HEARKEN’ with ‘WEBFORM’ and see if it works. If it does then I would say source_type needs to be one of some number of pre-determined values.

Thanks. I did shift to “WEBFORM” and got past that error. The idea of this being pre-defined inside InfusionSoft worries me, though. Is there a way to verify if there is a set number of pre-determined values, and what those values might be?

I’m now getting

{
  "message": "Input could not be converted to a valid request"
}

from this json

{"source_type":"WEBFORM","duplicate_option":"Email","given_name":"corey","family_name":"","email_addresses":[{"email":"coreyhaines@example.com","field":"EMAIL1"}],"opt_in_reason":"Opted out of form","tags":[]}

I’ll keep plugging away at this, as I’m hoping it is something like “tags can’t be empty if they are passed” or “family_name can’t be empty”. :slight_smile:

The REST implementation is still being built up and IS is doing their best to keep documentation up with production. Some specifics, as you can imagine, may yet to be added.

Okay, does look like taking the empty tags out works. Will have to put that into my code to not include that field if it is empty.

1 Like

Totally understandable. Is there a way to verify what the possible values of source_type are? And, importantly, is there a way to add to them.

My apologies for not looking as hard into the documentation/schema. I just found this after looking at the schema for creating a contact

source_type
string(optional)
Can be WEBFORM, LANDINGPAGE, IMPORT, MANUAL, API, OTHER or UNKNOWN

This clears up my question. I’m comfortable with closing this thread. Thanks!

1 Like