Events


GET /events

Query Parameters

Parameter Type Description
date DateRange Filter events by event date between the date range.
month Integer Filter events by month.
search String Filter events by matching the event name.
season Array Integer Filter events by associated season. Defaults to current season.
with String Values to join to event resource.
year Integer Filter events by year.

Joining Resources

Here is a list of available resources to join on events.

['tasks', 'tasks.account', 'tasks.users', 'tasks.users.avatar']

Example Requests

All Events that happend prior to 2020-01-01

https://example.trak.io/api/v1/events?date=0|2020-01-01

Event with ID 1

https://example.trak.io/api/v1/events/1

Example Response

{
    "success": true,
    "message": null,
    "data": {
        "data": [
            {
                "event_id": 1,
                "season_id": 1,
                "season": {
                    "season_id": 1,
                    "name": "2020-2021",
                    "active": true
                },
                "name": "Example Event",
                "date": {
                    "raw": "2019-06-01 19:53:20",
                    "formatted": "June 1, 2019"
                },
                "created_at": {
                    "raw": "2019-06-01 19:53:20",
                    "formatted": "June 1, 2019"
                },
                "updated_at": {
                    "raw": "2019-06-01 19:53:20",
                    "formatted": "June 1, 2019"
                }
            }
        ],
        ...
    }
}

POST /events

Query Parameters

Parameter Type Required Description
name String true The name of the event.
season_id Integer true The season of the event.
date DateTime true The date of the event.

Example Requests

{
    'date': '2020-01-01',
    'name': 'Example Event',
    'season_id': 1
}

Example Response

{
    "success": true,
    "message": "API_EVENT_CREATED",
    "data": {
        "event_id": 1,
        "name": "Example Event",
        "season_id": "1",
        "season": {
            "season_id": 1,
            "name": "2020-2021",
            "active": true
        },
        "date": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        },
        "updated_at": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        },
        "created_at": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        }
    }
}

PUT /accounts/{account_id}

Query Parameters

Parameter Type Required Description
name String true The name of the event.
season_id Integer true The season of the event.
date DateTime true The date of the event.

Example Requests

{
    'date': '2020-01-01',
    'name': 'Updated Event',
    'season_id': 1
}

Example Response

{
    "success": true,
    "message": "API_EVENT_UPDATED",
    "data": {
        "event_id": 1,
        "name": "Update Event",
        "season_id": "1",
        "season": {
            "season_id": 1,
            "name": "2020-2021",
            "active": true
        },
        "date": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        },
        "updated_at": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        },
        "created_at": {
            "raw": "2019-06-01 19:53:20",
            "formatted": "June 1, 2019"
        }
    }
}

DELETE /events/{event_id}

Example Response

{
    "success": true,
    "message": "API_EVENT_DELETED",
    "data": []
}