Search code examples
phpinfusionsoft

Infusionsoft API not returning orders by date


I am trying to integrate the Infusionsoft API and I am having some issues in retrieving orders. I need to get all the orders from yesterday and so far this is what I have done.

require_once("src/isdk.php");

$app = new iSDK;

if ($app->cfgCon("connectionName")) {

    echo "connected<br/>";
    echo "app connected<br/>";


    $qry = array('DateCreated' => $app->infuDate('10/30/2014'));
    $rets = array('Id', 'JobTitle', 'ContactId', 'StartDate', 'DueDate', 'JobNotes', 'ProductId', 'JobRecurringId', 'JobStatus', 'DateCreated', 'OrderType', 'OrderStatus', 'ShipFirstName', 'ShipMiddleName', 'ShipLastName', 'ShipCompany', 'ShipPhone', 'ShipStreet1', 'ShipStreet2', 'ShipCity', 'ShipState', 'ShipZip', 'ShipCountry');
    $cards = $app->dsQueryOrderBy("Job", 100, 0, $qry, $rets, 'DateCreated', false);

    echo "<pre>";
    print_r($cards);
    echo "</pre>";

} else {
    echo "Connection Failed";
}

The connection and everything works fine and I am able retrieve orders using other fields like Id. But for some reason searching through date doesn't work. I am not getting any errors below is the response which I get.

xmlrpcresp Object
(
    [val] => yes
    [valtyp] => phpvals
    [errno] => 0
    [errstr] => 
    [payload] => 
    [hdrs] => Array
        (
            [server] => Apache-Coyote/1.1
            [pragma] => no-cache
            [cache-control] => no-cache, no-store
            [expires] => Sat, 01 Nov 2014 00:19:59 GMT
            [content-type] => text/xml;charset=UTF-8
            [content-length] => 121
            [date] => Fri, 31 Oct 2014 12:19:59 GMT
            [set-cookie] => app-lb=3238199306.20480.0000; path=/
        )

    [_cookies] => Array
        (
            [app-lb] => Array
                (
                    [value] => 3238199306.20480.0000
                    [path] => /
                )

        )

    [content_type] => text/xml
    [raw_data] => HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Pragma: no-cache
Cache-Control: no-cache, no-store
Expires: Sat, 01 Nov 2014 00:19:59 GMT
Content-Type: text/xml;charset=UTF-8
Content-Length: 121
Date: Fri, 31 Oct 2014 12:19:59 GMT
Set-Cookie: app-lb=3238199306.20480.0000; path=/

<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value>yes</value></param></params></methodResponse>
)

And the format of the date is below.

20141030T00:00:00

Can anyone please help me with this?

I have also gone through similar questions and haven't found a solution.

Thanks in advance for help.


Solution

  • For those who run into the same problem below is the solution.

    Querying for date using the code below solve the problem for me.

    $qry = array('DateCreated' => '2014-10-30%');