0

I am using insufionsoft php API to fetch the details of orders for generating some stats for my reports page. I want to get the details of todays order, yesterdays order, last 7 days orders. I have connected using the API and able to fetch the contact details but I am not able to find any documentation related to fetch order details.

I have connected in this way to fetch contact using email

require_once("../src/isdk.php");
$app = new iSDK;
$app->cfgCon("gtrrde", "<Infusionsoft API key replaced>");
$contacts = $app->findByEmail('yu@yahoo.com', array('Id', 'FirstName', 'LastName', 'Email'));

How can I fetch all Order details ??

Marcus Rickert
  • 4,138
  • 3
  • 24
  • 29
Yunus Aslam
  • 2,447
  • 4
  • 25
  • 39

2 Answers2

1

You're going to want to use a DataService.query to query the Invoice or Job Tables. Since it appears you're using the PHP SDK, your queries will look something like the following:

$order_details = $app->dsQuery( 
                           (str)$table_name, 
                           (int)$number_of_records_to_return,
                           (int)$page, 
                           (struct)$query,
                           (array)$fields_to_return
                       );    

So, following this pattern, here would be a sample Job Table query to return all Jobs from a specified $date (in the InfusionSoft format):

Job Table Query:

$returnFields = array('Id','ShipFirstName', 'ShipLastName');
$query = array('DateCreated' => $date);
$jobs = $app->dsQuery("Job", 10, 0, $query, $returnFields);
rnevius
  • 26,578
  • 10
  • 58
  • 86
  • Its working but I am having some issue. I have 446 contacts in infusion soft and I am getting 449 contacts through API.. That is strange but how can I figure that out ?? Any Idea ?? – Yunus Aslam Sep 23 '14 at 06:22
  • Have you tried doing a DataService.query on the contacts table, with the wildcard `'%'` passed in as the query? Example: `$contact_data = $app->dsQuery( 'Contact' , 1000 , 0 , array('Id' => '%') , array('FirstName') );` ...and then `var_dump($contact_data);`? When I do this, the correct number of contacts are returned... – rnevius Sep 23 '14 at 07:21
  • Yes I did this and now it is working fine but with a little more changes : `array('Id' => '%', 'Email' => '%')` .. Thanks for your support. Now can you also tell me how can I fetch last 30days Order details ?? – Yunus Aslam Sep 23 '14 at 11:35
  • What will be the format of the date? I've tried creating dates using the `infuDate()` method but I always get blank response. – Jay Bhatt Oct 31 '14 at 12:06
  • Have you tried `date('Ymd\TH:i:s');`?...Here's the function from the PHP SDK: https://github.com/infusionsoft/PHP-iSDK/blob/master/src/isdk.php#L1976 – rnevius Oct 31 '14 at 12:38
  • Can this question be updated to current IS API? This info appears to not be relevant and links no longer work. – cyberwombat Dec 03 '16 at 00:28
0

I would first of all change your API Key now.

Second you need to use DataService.query on the Job/Invoice tables.

https://developer.infusionsoft.com/docs/read/Data_Service#query

Table Documentation

Is there any specific data you are looking for on the Orders? That may need more API calls to get.