Forums

Services API: Services expire too quickly when not fetching "all" services

So currently I'm using the `services/getAll.json` method to grab a list of all services. I'm using this in the song book webapp that I have so a user can choose the current service to rehearse with. 


The problem is that after the initial service has started, the service will disappear from new API calls (unless I set it to show "all" services). Right now I'm doing that, so that I can then parse and only show the ones in the future or on the current day. But I know that's going to become unwieldy after a year or two. That loop will only continue to grow.


Ideally what I'd like to be able to do is one of the following:


1. Don't remove the service from the API call until after the last service has ended.


OR


2. Allow a date, or range of dates, to be specified when fetching all services. So we could say, give me all services from 2 weeks prior and 4 weeks in the future, etc...


Thanks!

Hi Kennon


Thanks for the question.


I can see how this would be an issue. 


We're going to be re-looking at our API soon and making some improvements and I've added this as a feature request.


Hope this helps,

Stewart

Hi Kennon.


I just had a look and a bit more of a think about this.


Another option you have, instead of using the services/getAll endpoint to get the list of the services, you could use the calendar/events/getAll endpoint to get this information by specifying calendar = services.


For example, using python.

 

API_KEY = # YOUR API KEY
info = {'start': '2016-01-01', 'calendar': 'services', 'end': '2016-06-03'}
c = ElvantoAPI.Connection(APIKey=API_KEY)
services = c._Post("calendar/events/getAll", **info)['events']['event']

 

This would then return the list of the services and you can pull their ID.

Great! Thanks, I'll give that a shot. :D


Login or Signup to post a comment