Staying Updated

It’s common for event information to change frequently. For example, a date changes, an event gets cancelled or ranking is updated. It’s important to keep your data set up to date.

Other Providers

Many event providers don’t remove expired or cancelled events from their data, requiring you to take a full data export each time, wasting time and effort. We help to make the process of staying updated easier.

Why is this important ?

Events often change or get deleted because they’re cancelled, postponed, marked as duplicates or identified as spam. In February 2020, concerns about COVID-19 led to a 500% spike in cancellations and postponements of significant events when compared to February 2019. It’s important to make sure you regularly refresh your store of intelligent event data and keep your local database in sync with ours to stay up-to-date.


How to do it

Choose whether you want to look at events that are still occurring, have been cancelled, or postponed.

Active Events

The active.* parameter makes it easy to find events that are happening during a date range, including ones that start before and/or after the range. If an event overlaps with the range, it’ll be included.

  • GET /v1/events?active.gte=2020-01-01&active.lte=2020-01-31 HTTP/1.1
    Authorization: Bearer $ACCESS_TOKEN
    
  • curl -X GET "https://api.predicthq.com/v1/events?active.gte=2020-01-01&active.lte=2020-01-31" \
         -H "Authorization: Bearer $ACCESS_TOKEN"
    
  • import requests
    
    response = requests.get(
        url="https://api.predicthq.com/v1/events",
        headers={
          "Authorization": "Bearer $ACCESS_TOKEN",
          "Accept": "application/json"
        },
        params={
            "active.gte": "2020-01-01",
            "active.lte": "2020-01-31"
        }
    )
    
    print(response.json())
    

Updated Events

When you store events and are interested in retrieving a list of all events that have changed since a specific date and time, the updated.* parameter is useful in conjunction with the state=* parameter.

  • GET /v1/events/?updated.gte=2020-01-01&updated.lte=2020-02-29&state=active,deleted HTTP/1.1
    Authorization: Bearer $ACCESS_TOKEN
    
  • curl -X GET "https://api.predicthq.com/v1/events/?updated.gte=2020-01-01&updated.lte=2020-02-29&state=active,deleted" \
         -H "Authorization: Bearer $ACCESS_TOKEN"
    
  • import requests
    
    response = requests.get(
        url="https://api.predicthq.com/v1/events",
        headers={
          "Authorization": "Bearer $ACCESS_TOKEN",
          "Accept": "application/json"
        },
        params={
            "updated.gte" : "2020-01-01",
            "updated.lte" : "2020-02-29",
            "state" : "active,deleted"
        }
    )
    
    print(response.json())
    

Cancelled and Postponed Events

The most accurate forecasting requires constant updates as event data is so dynamic. It’s important to have real-time updates on events if they have been cancelled or postponed so you can react swiftly. If you want to only look at events that have been cancelled or postponed, use the parameter deleted_reason=cancelled, postponed.

  • GET /v1/events/?updated.gte=2020-03-01&updated.lte=2020-03-31&state=deleted&deleted_reason=cancelled,postponed HTTP/1.1
    Authorization: Bearer $ACCESS_TOKEN
    
  • curl -X GET "https://api.predicthq.com/v1/events/?updated.gte=2020-03-01&updated.lte=2020-03-31&state=deleted&deleted_reason=cancelled,postponed" \
         -H "Authorization: Bearer $ACCESS_TOKEN"
    
  • import requests
    
    response = requests.get(
        url="https://api.predicthq.com/v1/events",
        headers={
          "Authorization": "Bearer $ACCESS_TOKEN",
          "Accept": "application/json"
        },
        params={
            "updated.gte" : "2020-03-01",
            "updated.lte" : "2020-03-31",
            "state" : "deleted",
            "deleted_reason" : "cancelled,postponed"
        }
    )
    
    print(response.json())