I am trying to integrate my app with Infusionsoft using the PHP SDK. I have been using the sample addWithDupCheck.php as my guide on how to do what I need (because that is basically the functionality I am working on already) but have hit a road block. When I try to do the dupe check using the line
the entire script stops running with the following Fatal Error
PHP Fatal error: Call to undefined method Infusionsoft\Api\ContactService::where() in /var/www/dan/test_script.php on line 31
I’m stumped, it seems like the error is telling me that “where” can’t be used with contacts even though the sample claims it can be. Am I missing something obvious?
Not sure what you mean. This is the README in the repo of the Infusionsoft PHP SDK. There where is documented in the examples in it. Under Making Rest Requests
@bradb@John_Borelli Thank you both for your responses. The Readme that was linked is the one that goes with the SDK that I am using. I used composer to install that package on my server. The line in the Readme not the example I was using but I did see where() mentioned in it for tasks so that’s why I started to wonder if contacts just wasn’t set to use it as well.
I assumed that samples included with the package would work using that same package, it seems silly to include non-functional samples. Is that not the case?
Let’s clarify terms. In the Infusionsoft API community the SDK has always referred to the iSDK or the legacy, legacy api that uses the app api key method for authentication. The API is in reference to the current (although termed legacy) api that only uses oauth (this is not the sdk)
@John_Borelli Well that is a bit misleading, especially since the label on the repository is Infusionsoft PHP SDK. But either way, the question still stands, the sample provided in the repository that does what I need throws a fatal error when used. So is it a case where the sample is no longer functional, and if so how do we do the same thing? Or is there something else going on that I am missing by looking at that sample script?
We should get together and clarify terms That is definitely not the same terms we use internally. We just always refer the the php sdk by versions. We referer to the API as the combination of the XML/RPC and REST endpoints on our end. We refer to the SDKs as just layers on top of the APIs to make life easier. Anyhow, maybe we should create a pinned post with terminology.
Clarification would definitely be good. The sdk has a much different version number than the oauth api version in current use. documentation also provides for separate examples because the sdk is structured completely differently than the current api and looks nothing like the examples for the current api. So in documentation on the right where code examples are available, there is the options for PHP, PHP iSDK, XML-RPC and Python. REST has it’s own interactive docs page. The PHP goes over the oauth version (current). The PHP iSDK goes over the oldest version (using app key). XML-RPC and REST are more obvious. However, and I’m 100 percent certain of this, the documentation has only, within the past week, been changed to show oauth for the sdk as well as it showed the app key use up until then…this is a very recent change but it still remains that the use of the sdk differs from the php api version in current use.
example
to add a contact with the sdk you would instantiate the object and then make the call
$app->addWithDupCheck(array(‘FirstName’ => ‘test’, ‘LastName’ => ‘test’, ‘Email’ => ‘test@test.com’), ‘EmailAndName’);
@MichaelFairchild I used the same line as is listed in the readme, so it is requiring 1.2.*.
As for the terminology, I will let others debate that, although from a general terminology point of view (for general programming, not in regards to specific Infusionsoft usage) the current use of SDK is correct. The API would be the underlying layer while the actual PHP framework would be an SDK.
@MichaelFairchild Thank you, that seems to have done the trick. Now when I run the script it returns results like it should. Hopefully this will be the end of my problems and it will go smoothly from here