API3
ethanpooley at March 18th, 2015 13:33 — #1
I won't always have a last name for contacts at creation time, so I'm trying to write my code to allow that. I find that if the last_name field is missing or empty, the request errors. Using a space character as a value doesn't work either, so I'm curently using the string 'Unknown' as a last name where necessary.
Is there a way around this? I've tried throwing the 'partial' flag but that doesn't help.
Where do I find a list of required fields for each request type? I haven't been able to find where in the API docs it says that last_name is actually required.
pete_onepagecrm at March 18th, 2015 16:24 — #2
Hi Ethan,
Yes, you need either the last_name or company field to create a contact.
This is the exact same as how the main web app works - you need either of these fields to save a contact in OnePageCRM.
Let me know if there's anything else I can do for you.
ethanpooley at March 19th, 2015 10:49 — #3
Okay. I'd just comment that this requirement doesn't conform to real situations as well as I'd like. It's nice to be able to put in very un-finished contacts and add information later, and last name is a common one in my case. But I'll stick with "Unknown" for now.
Are these and other field requirements listed somewhere in the API docs?
pete_onepagecrm at March 19th, 2015 11:18 — #4
Hi Ethan,
The API should respond with instructions explaining this requirement:
{status"=>400,
"message"=>"Invalid request data",
"error_name"=>"invalid_request_data",
"error_message"=>"A validation error has occurred",
"errors"=>
{"last_name"=>
"Either last name or company name are required to create a Contact.",
"company_name"=>
"Either last name or company name are required to create a Contact."}}
Sorry that this restriction doesn't match your use case - we have this restriction to stop people from adding contacts without enough details and filling their account with unfinished contacts.
ethanpooley at March 19th, 2015 12:31 — #5
In my case I'm pushing leads entered by consumers on my website. I don't require a last name from them, just a phone or email and a first name.
Thank you for the API info - I'll make sure to check those responses. It seems better though if the web documentation itself has all the information required to produce a valid request.
pete_onepagecrm at March 24th, 2015 05:55 — #6
Thanks Ethan, good point. I'll ask @JohnMag to update our documentation site with this requirement.
Powered by Discourse, best viewed with JavaScript enabled