PHP getContacts() method and variables

Do you know why this PHP getConatcts() doesn't seem to see the variable $lastname here?

$lastname = $_GET["lastname"];
$contacts = $i->getContacts(array("filters" => array('LAST_NAME=\'$lastname\'')));

If I hard code a name in the array for examle: $contacts = $i->getContacts(array("filters" => array('LAST_NAME=\'Smith\'')));

it accepts it and returns results, but with the variable $lastname it returns nothing - and there is no error so it must not see it. - It's probably a syntax error on my part but I would appreciate anyone pointing me in the right direction :)



  • Official comment

    Hi John,

    Your best bet in the short term is to use to auto-generate a PHP wrapper from our API. See for docs and sandbox. The Swagger API definition file (JSON) is at

    Sorry the PHP library is not very actively maintained. We primarily work with C#, Java and Python here (I maintain the Python library). The Python library is a good example of how to build a relatively small client around the API (it has a handful of functions that automate common CRUD operations, without defining a function for every single API endpoint).

    If you have any other questions, please let us know. Thanks.

    Brian McConnell

    Insightly Engineering Team

    Comment actions Permalink
  • Hi John,

    Are you working on a new integration or updating an existing one. The reason I'm asking is that we just released a Beta of our new api v2.2 which supports Swagger which allows you to auto-generate api wrappers for you're desired language, supports up to 15 different languages. We're still fine tuning our Swagger Spec but most of the functionality is there already.

    Our PHP library is not very actively maintained at the moment and we'll probably deprecate it as soon as v2.2 moves out of Beta. However, we should be able to get an answer to the problem your having next week. 

    Insightly Swagger Spec:


    Comment actions Permalink
  • Hi Patrick,

    I'm currently using

    Can you point me to another/new PHP API I can use?



    Comment actions Permalink
  • Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.

    Comment actions Permalink
  • Hi Patrick,

    We tried to sign up an account at, and tried to search for Insight, but do not find the API or docs.  Have they been hidden currently?  I tried to create a test API, and I was able to generate the PHP SDK.  I was just wondering if there are instructions for us to generate the PHP SDK for Insightly.

    Also, on another topic, is it not possible to support an official SDK by Insightly on Packagist that supports the latest API version 2.3?  It seems to be more easier for PHP developers to get started, especially when most developers probably have had no experience with using Swagger previously.

    (FYI we're an existing customer, we have more than 20 licenses with you guys.  We are revamping our website and will be integrating with Insightly.  However, we are hitting a deadend at the moment, so we hope that you can assist us on this matter, earlier if possible.  We will be very much appreciated)

    Thank you very much for your assistance in advance!


    Comment actions Permalink
  • Hi Thomas,

    The API docs for the latest 3.0 version can be found here: 

    The swagger specification can be found here:

    You can change the version number in the URLs to access the older versions of the API.

    For more information on how to generate an SDK from the swagger spec, please refer to the swagger code-gen documentation:

    Thank you for the suggestion about using Packagist, I'm not familiar with it myself but I will bring it up to the team. For now, I would suggest following the instructions on how to use the Swagger Code Generation tool and see if you can get it working that way.

    Hope that helps! Let us know if you have any further questions.

    Comment actions Permalink

Please sign in to leave a comment.