Posted: December 12, 2015 at 2:27 pm
|
I have over 200 events in my Espresso app, and I’m using the JSON API add-on to pull events to a second website. Since the automatic limit is 50 events and many of my events are recurring, the ID numbers are not in a series. So, my API is only pulling the first 50 events that have the lowest ID numbers, not the events with the earliest start dates. (See http://www.leadersinstitute.com/public-speaking/public-speaking-class.) Since I set the Houston classes up before the list in other cities, all 12 of the Houston events have lower ID numbers than events that I inputed later. So, the API is pulling Houston events that occur a year from now instead of events in other cities that will be next month. Here is the code: function f_espresso_event_list( $atts ){ //$url1 = “http://www.fearlesspresentations.com/espresso-api/v1/events/”.$token[‘body’][‘session_key’].”.json/”; function sortByOrder($a, $b) { Any idea on how to make the API pull events that are first in the date series versus lowest ID number? |
Hi Doug, You can add an AND to the query, set a $futuredate variable one or two months from now (you’ll know about how far out), so your query looks like this:
|
|
|
Josh, thanks, but I’m a little over my head on this (not a programmer). I tried to setup the variable for 3 months out using… $futuredate = date(“Y-m-d H:i:s”,strtotime(“+3 months”, strtotime($futuredate))); But now I’m getting nothing. I’m sure it is my syntax, but not sure what I’ve done wrong. |
Hi Doug, You’ll find some syntax examples in this entry at PHP.net: http://php.net/manual/en/function.strtotime.php#example-2541 |
|
The support post ‘JSON API Add-on Get Events within a Date Range’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.