• Register

ACTIVE Network API Forums

API Forum

RSS Feed

API Date Functions

    • active Admin
    • Topic created 17 years ago

    From Tim:

    I have been trying to get the date functions of the API to work but am having issues. Can you advise? Here is the url i am passing

    http://api.amp.active.com/assets/running?mediaType=Event%5CMarathon&zip=55409&distance=50&startDate=2009-01-01&endDate=2009-12-01&order=asc&api_key={apiKey}

    Also the 'order' does not appear to be working either.

    Message edited by active Admin 17 years ago

  1. active Admin – 17 years ago

    Hey Tim,

    Using "startDate" and "endDate" here is the same as saying "show me all marathons that start on date x and end on date y". I think what you're trying to do is get a list of all marathons added to the system since date x. To do this, you'll need to run this query for each date since x (as the Asset Syndication API can only return 1000 results per call):

    http://api.amp.active.com/assets/running?mediaType=Event\Marathon&zip=55409&distance=50&lastModified=2009-01-01&sort=startDate&order=asc&api_key=rnxjx6ts3pg579gvrbe42qn7.

    Note the "sort" value is set to "startDate" indicating which field to sort on. With "sort" specified, the "order" field works too.

  2. Tim – 17 years ago

    Okay so I read your post and what I was trying to do was get a list of events for a given timeframe. For example all marathons in sept 2009 50 miles form my ZIP ordered by ASC.

    How would I structure this query?

  3. active Admin – 17 years ago

    Unfortunately our date range logic is lacking at the moment. You could do this several ways:

    1. run a search for all marathons happening in a given location, i.e. http://api.amp.active.com/assets/running?mediaType=Event\Marathon&zip=55409&distance=50&sort=startDate&order=asc&api_key=rnxjx6ts3pg579gvrbe42qn7, then parse out those happening in September.

    2. run a search for each day in the date range:

    http://api.amp.active.com/assets/running?mediaType=Event\Marathon&zip=55409&distance=50&startDate=2009-01-01&api_key=rnxjx6ts3pg579gvrbe42qn7

    http://api.amp.active.com/assets/running?mediaType=Event\Marathon&zip=55409&distance=50&startDate=2009-01-02&api_key=rnxjx6ts3pg579gvrbe42qn7

    etc.

[ Page 1 of 1 ]