This object is in archive! 

Retrieve a list of leads filtered by date via the API

Andrew K. shared this idea 7 years ago
Completed

Is there a way to retrieve a list of leads filtered by an arbitrary date? Ideally I'd want something like this to work—


  1. $ http get 'https://www.inflatableoffice.com/api1/leads/' \
  2. > apiKey=="$IO_API_KEY" \
  3. > limit=='3' \
  4. > status[]=='4921' status[]=='29613' status[]=='6967' status[]=='9013' \
  5. > date=='8/1/2017 - 8/1/2017' \
  6. > | jq '.items[].eventstarttime'
  7. "2023-04-25T12:15:00-07:00"
  8. "2023-04-25T12:15:00-07:00"
  9. "2020-02-22T12:00:00-08:00"


—but of course right now the status[] and date parameters are ignored. Specifying the statuses via a predefined filter would be fine, but I need the date to be variable.

Best Answer
photo

Try the following:- switch api1 to api2

- &status[]=4921&status[]=29613....

- &date=URLENCODE('2023-04-25 - 2024-04-25')


You should be able to build the URL the same way that the view report URL does for filtering.

Comments (2)

photo
1

Try the following:- switch api1 to api2

- &status[]=4921&status[]=29613....

- &date=URLENCODE('2023-04-25 - 2024-04-25')


You should be able to build the URL the same way that the view report URL does for filtering.

photo
1

Thanks, that sounds like just what I need! It looks like it's having trouble generating the response, though:


  1. $ http --verbose get "https://www.inflatableoffice.com/api2/leads/?apiKey=${IO_API_KEY}&status[]=9013&date=8%2F1%2F2017%20-%208%2F1%2F2017";
  2. GET /api2/leads/?apiKey=redacted&status[]=9013&date=8%2F1%2F2017%20-%208%2F1%2F2017 HTTP/1.1
  3. Accept: */*
  4. Accept-Encoding: gzip, deflate
  5. Connection: keep-alive
  6. Host: http://www.inflatableoffice.com
  7. User-Agent: HTTPie/0.9.8
  8. HTTP/1.1 200 OK
  9. Access-Control-Allow-Methods: *
  10. Access-Control-Allow-Orgin: *
  11. Connection: Keep-Alive
  12. Content-Encoding: gzip
  13. Content-Length: 376
  14. Content-Type: application/json
  15. Date: Thu, 28 Sep 2017 20:39:30 GMT
  16. Keep-Alive: timeout=5, max=100
  17. Server: Apache/2.4.25 (Red Hat) OpenSSL/1.0.1e-fips
  18. Vary: Accept-Encoding,User-Agent
  19. X-Powered-By: PHP/7.0.23
  20. <br />
  21. <b>Fatal error</b>: Uncaught Error: Call to undefined method stdClass::balance_due() in /var/www/vhosts/inflatableoffice.com/httpdocs/api2/API.class.php:3257
  22. Stack trace:
  23. #0 /var/www/vhosts/inflatableoffice.com/httpdocs/api2/API.class.php(1744): MyAPI->cleanClass(Object(stdClass), 'lead', '-800', '1', false)
  24. #1 /var/www/vhosts/inflatableoffice.com/httpdocs/api2/API.class.php(1165): MyAPI->leads_list()
  25. #2 /var/www/vhosts/inflatableoffice.com/httpdocs/api2/API.class.php(81): MyAPI->leads(Array)
  26. #3 /var/www/vhosts/inflatableoffice.com/httpdocs/api2/api.php(15): API->processAPI()
  27. #4 {main}
  28. thrown in <b>/var/www/vhosts/inflatableoffice.com/httpdocs/api2/API.class.php</b> on line <b>3257</b><br />
  29. Sorry, an error has occurred. Please try again later. The developers have been notified.


I've also tried adding columns[]=1 to skip the balance due calculation but it doesn't seem to change anything.

photo
2

This issue should now be fixed.

Replies have been locked on this page!