PHP getContacts() method and variables

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

example:
$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 :)

0

Comments

6 comments
  • Official comment

    Hi John,

    Your best bet in the short term is to use swagger.io to auto-generate a PHP wrapper from our API. See api.insight.ly/v2.2/Help for docs and sandbox. The Swagger API definition file (JSON) is at https://api.insight.ly/v2.2/swagger/docs/v2.2

    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:

    https://api.insight.ly/v2.2/swagger/docs/v2.2

    CodeGen:

    https://github.com/swagger-api/swagger-codegen

    0
    Comment actions Permalink
  • Hi Patrick,

    I'm currently using https://github.com/Insightly/insightly-php

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

    Thanks,

    John

    1
    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.
    http://www.zerobugacademy.com/python-training-in-chennai

    1
    Comment actions Permalink
  • Hi Patrick,

    We tried to sign up an account at swagger.io, 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!

     

    0
    Comment actions Permalink
  • Hi Thomas,

    The API docs for the latest 3.0 version can be found here: https://api.insightly.com/v3.0/Help 

    The swagger specification can be found here: https://api.insightly.com/v3.0/swagger/docs/v3.0

    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: https://github.com/swagger-api/swagger-codegen

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.