Trak Software Documentation logo

Events


GET /events

Query Parameters

Parameter Type Description
date DateRange Filter events by event date between the date range.
join String Values to join to account resource.
month Integer Filter events by month.
search String Filter events by matching the account name.
season Integer Filter events by associated season. Defaults to current season.
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": {
        "current_page": 1,
        "data": [
            {
                "event_id": 1,
                "site_id": 1,
                "user_id": 1,
                "season_id": 1,
                "name": "Example Event",
                "date": "2018-12-01 00:00:00",
                "created_at": "2018-12-07 19:01:29",
                "updated_at": "2018-12-07 19:01:29",
                "tasks": []
            }
        ],
        "first_page_url": "https://example.trak.io/api/v1/events?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "https://example.trak.io/api/v1/events?page=1",
        "next_page_url": null,
        "path": "https://example.trak.io/api/v1/events",
        "per_page": 50,
        "prev_page_url": null,
        "to": 4,
        "total": 4
    }
}

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": {
        "site_id": 1,
        "user_id": 1,
        "name": "Example Event",
        "season_id": "1",
        "date": "2020-01-01 00:00:00",
        "updated_at": "2019-02-15 18:25:48",
        "created_at": "2019-02-15 18:25:48",
        "event_id": 1
    }
}

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": 6,
        "site_id": 1,
        "user_id": 1,
        "season_id": "1",
        "name": "Updated Event",
        "date": "2020-01-01 00:00:00",
        "created_at": "2019-02-15 18:25:48",
        "updated_at": "2019-02-15 18:26:50"
    }
}

DELETE /events/{event_id}

Example Response

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