# REST API

## Get crowd entries

<mark style="color:blue;">`GET`</mark> `https://avoid-crowds.dev/api/crowds`

This endpoint allows you to get crowd entries.

#### Query Parameters

| Name                   | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ---------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| include                | string | Include your region to access crowd entries for that region. An overview of regions can be found under 'additional information'. Single available value: `region`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| sort                   | string | <p>The sort query parameter is used to determine by which property the results collection will be ordered. Sorting is ascending by default. Adding a hyphen (<code>-</code>) to the start of the property name will reverse the results collection. In case of sorting by multiple fields, you can write the fields in string format, separated by comma without spaces. Available fields for sorting: <br><code>date</code><br><code>avoid\_crowds\_score</code><br><code>total\_cruise\_passengers</code><br><code>total\_cruise\_crew</code><br><code>local\_public\_holiday</code></p>                                                                                                          |
| fields\[crowds]        | string | <p>Sometimes you'll want to fetch only a couple fields to reduce the overall size of your SQL query. This can be done using the fields query parameter. In case of getting multiple fields, write fields in string format, separated by comma without space after the comma. Available fields for sorting: <br><code>id</code><br><code>title</code><br><code>description</code><br><code>date</code><br><code>avoid\_crowds\_score</code><br><code>total\_cruise\_passengers</code><br><code>total\_cruise\_crew</code><br><code>ships\_in\_port</code><br><code>local\_public\_holiday</code><br><code>local\_school\_vacation</code><br><code>local\_events</code><br><code>vacations</code></p> |
| filter                 | array  | The filter query parameters can be used to filter results by partial property value, exact property value or if a property value exists in a given array of values. There are a lot of flexible filters for crowds below.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| filter\[date]          | string | <p>Get entries for dates in many different ways. Format of date: <br><code>Y-m-d</code> (For example, 2019-05-25)<br><code>+</code> (equal to <code>tomorrow</code>)<br><code>-</code> (equal to <code>yesterday</code>)<br><code>ago</code><br><code>first</code> <br><code>next</code> <br><code>last</code><br><code>this</code><br><code>yesterday</code><br><code>today</code><br><code>tomorrow</code><br>Some date parameter examples:<br><code>next wednesday</code><br><code>last friday</code><br><code>this thursday</code></p>                                                                                                                                                          |
| filter\[days\_before]  | string | Get entries before current day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| filter\[days\_after]   | string | Get entries after current day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| filter\[days\_between] | string | Get entries between two days. Format of dates is the same as for filter\[date]. Two dates must be separated by comma without space after comma. Example: `today,next Friday`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| filter\[region]        | string | Filterting entries by parameters in array. Full list of regions can be found on region list page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

#### Headers

| Name           | Type   | Description                                                                                                                  |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Authentication | string | Bearer token is API key for full access to Avoid Crowds API. Example string for Authentication header: `Bearer {your-token}` |

{% tabs %}
{% tab title="200 Crowd entries successfully retrieved (short example). Response for request without any query parameters" %}

```javascript
[
    {
        "id": 4478,
        "title": "Big Crowds expected on May 24 in Venice",
        "description": null,
        "date": "2019-05-24",
        "avoid_crowds_score": 70,
        "total_cruise_passengers": "5184",
        "total_cruise_crew": "1805",
        "ships_in_port": "MSC Lirica\t2371\nNorwegian Star\t2813",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": null
    },
    {
        "id": 4479,
        "title": "Very Big Crowds expected on May 25 in Venice",
        "description": null,
        "date": "2019-05-25",
        "avoid_crowds_score": 100,
        "total_cruise_passengers": "12920",
        "total_cruise_crew": "4815",
        "ships_in_port": "Costa Luminosa\t2712\nMSC Musica\t3060\nMSC Sinfonia\t2340\nOceania Riviera\t1447\nRhapsody Of The Seas\t2431\nViking Star\t930",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    },
    {
        "id": 4480,
        "title": "Very Big Crowds expected on May 26 in Venice",
        "description": null,
        "date": "2019-05-26",
        "avoid_crowds_score": 100,
        "total_cruise_passengers": "12409",
        "total_cruise_crew": "4011",
        "ships_in_port": "AIDAblu\t2500\nCosta Deliziosa\t2712\nms Veendam\t1620\nMSC Magnifica\t3007\nMSC Opera\t2570",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    },
    {
        "id": 4481,
        "title": "Big Crowds expected on May 27 in Venice",
        "description": null,
        "date": "2019-05-27",
        "avoid_crowds_score": 70,
        "total_cruise_passengers": "2874",
        "total_cruise_crew": "1108",
        "ships_in_port": "Marella Celebration\t1254\nms Veendam\t1620",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    }
]
```

{% endtab %}

{% tab title="401 Incorrect API token" %}

```javascript
{
    "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403 User was restricted in admin panel" %}

```javascript
{
    "message": "Restricted user"
}
```

{% endtab %}

{% tab title="404 Incorrect address of API route" %}

```javascript
{
    "message": ""
}
```

{% endtab %}

{% tab title="500 Could not find a crowds matching this query." %}

```javascript
{
    "message": "Server Error"
}
```

{% endtab %}
{% endtabs %}

## Get crowd entries by region

<mark style="color:blue;">`GET`</mark> `https://avoid-crowds.dev/api/crowds/{region}`

#### Query Parameters

| Name                   | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| include                | string | Include related region for crowd entry. Single available value: `region`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| sort                   | string | <p>The sort query parameter is used to determine by which property the results collection will be ordered. Sorting is ascending by default. Adding a hyphen (-) to the start of the property name will reverse the results collection. In case of sorting by multiple fields, write the fields in string format, separated by comma without space. Available fields for sorting: <br><code>date</code><br><code>avoid\_crowds\_score</code><br><code>total\_cruise\_passengers</code><br><code>total\_cruise\_crew</code><br><code>local\_public\_holiday</code></p>                                                                                                                             |
| fields\[crowds]        | string | <p>In case you want to fetch only a couple fields to reduce the overall size of your SQL query. This can be done using the fields query parameter. In case of getting multiple fields, write fields in string format, separated by comma without a space after the comma. Available fields for sorting: <br><code>id</code><br><code>title</code><br><code>description</code><br><code>date</code><br><code>avoid\_crowds\_score</code><br><code>total\_cruise\_passengers</code><br><code>total\_cruise\_crew</code><br><code>ships\_in\_port</code><br><code>local\_public\_holiday</code><br><code>local\_school\_vacation</code><br><code>local\_events</code><br><code>vacations</code></p> |
| filter                 | array  | The filter query parameters can be used to filter results by partial property value, exact property value or if a property value exists in a given array of values. There are a lot of flexible filters for crowds below.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| filter\[date]          | string | <p>Get entries for dates in many differents ways. Format of date: <br><code>Y-m-d</code> (For example, 2019-05-25)<br><code>+</code> (equal to <code>tomorrow</code>)<br><code>-</code> (equal to <code>yesterday</code>)<br><code>ago</code><br><code>first</code><br><code>next</code><br><code>last</code><br><code>this</code><br><code>yesterday</code><br><code>today</code><br>Some date parameter examples:<br><code>next wednesday</code><br><code>last friday</code><br><code>this thursday</code></p>                                                                                                                                                                                 |
| filter\[days\_before]  | string | Get entries before passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| filter\[days\_after]   | string | Get entries after passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| filter\[days\_between] | string | Get entries between two days. Format of dates is the same as for filter\[date]. Two dates must be separated by comma without a space after the comma. Example: `today,next Friday`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

#### Headers

| Name           | Type   | Description                                                                                                                  |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Authentication | string | Bearer token is API key for full access to Avoid Crowds API. Example string for Authentication header: `Bearer {your-token}` |

{% tabs %}
{% tab title="200 Crowd entries successfully retrieved (short example). Response for request without any query parameters" %}

```javascript
[
    {
        "id": 4478,
        "title": "Big Crowds expected on May 24 in Venice",
        "description": null,
        "date": "2019-05-24",
        "avoid_crowds_score": 70,
        "total_cruise_passengers": "5184",
        "total_cruise_crew": "1805",
        "ships_in_port": "MSC Lirica\t2371\nNorwegian Star\t2813",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": null
    },
    {
        "id": 4479,
        "title": "Very Big Crowds expected on May 25 in Venice",
        "description": null,
        "date": "2019-05-25",
        "avoid_crowds_score": 100,
        "total_cruise_passengers": "12920",
        "total_cruise_crew": "4815",
        "ships_in_port": "Costa Luminosa\t2712\nMSC Musica\t3060\nMSC Sinfonia\t2340\nOceania Riviera\t1447\nRhapsody Of The Seas\t2431\nViking Star\t930",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    },
    {
        "id": 4480,
        "title": "Very Big Crowds expected on May 26 in Venice",
        "description": null,
        "date": "2019-05-26",
        "avoid_crowds_score": 100,
        "total_cruise_passengers": "12409",
        "total_cruise_crew": "4011",
        "ships_in_port": "AIDAblu\t2500\nCosta Deliziosa\t2712\nms Veendam\t1620\nMSC Magnifica\t3007\nMSC Opera\t2570",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    },
    {
        "id": 4481,
        "title": "Big Crowds expected on May 27 in Venice",
        "description": null,
        "date": "2019-05-27",
        "avoid_crowds_score": 70,
        "total_cruise_passengers": "2874",
        "total_cruise_crew": "1108",
        "ships_in_port": "Marella Celebration\t1254\nms Veendam\t1620",
        "local_public_holiday": null,
        "local_school_vacation": 0,
        "local_events": null,
        "vacations": "England, Wales, Luxembourg"
    }
]
```

{% endtab %}

{% tab title="401 Incorrect API token" %}

```javascript
{
    "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403 User was restricted in admin panel" %}

```javascript
{
    "message": "Restricted user"
}
```

{% endtab %}

{% tab title="404 Incorrect address of API route" %}

```javascript
{
    "message": ""
}
```

{% endtab %}

{% tab title="500 Could not find a crowds matching this query." %}

```javascript
{
    "message": "Server Error"
}
```

{% endtab %}
{% endtabs %}

## Get public holidays

<mark style="color:blue;">`GET`</mark> `https://avoid-crowds.dev/api/public_holidays`

#### Query Parameters

| Name                   | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ---------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter\[source]        | string | Get entries filtered by source                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| filter\[provinces]     | string | Get entries filtered by provinces                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| filter\[scope]         | string | Get entries filtered by scope                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| filter\[name]          | string | Get entries filtered by name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| filter\[country]       | string | Get entries filtered by country                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| sort                   | string | <p>The sort query parameter is used to determine by which property the results collection will be ordered. Sorting is ascending by default. Adding a hyphen (-) to the start of the property name will reverse the results collection. In case of sorting by multiple fields, write the fields in string format, separated by comma without space. Available fields for sorting: <br><code>name</code><br><code>country</code><br><code>scope</code><br><code>provinces</code></p>                               |
| filter                 | array  | The filter query parameters can be used to filter results by partial property value, exact property value or if a property value exists in a given array of values. There are a lot of flexible filters for crowds below.                                                                                                                                                                                                                                                                                        |
| filter\[date]          | string | <p>Get entries for dates in many differents ways. Format of date: <br><code>Y-m-d</code> (For example, 2019-05-25)<br><code>+</code> (equal to <code>tomorrow</code>)<br><code>-</code> (equal to <code>yesterday</code>)<br><code>ago</code><br><code>first</code><br><code>next</code><br><code>last</code><br><code>this</code><br><code>yesterday</code><br><code>today</code><br>Some date parameter examples:<br><code>next wednesday</code><br><code>last friday</code><br><code>this thursday</code></p> |
| filter\[days\_before]  | string | Get entries before passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| filter\[days\_after]   | string | Get entries after passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| filter\[days\_between] | string | Get entries between two days. Format of dates is the same as for filter\[date]. Two dates must be separated by comma without a space after the comma. Example: `today,next Friday`                                                                                                                                                                                                                                                                                                                               |

#### Headers

| Name           | Type   | Description                                                                                                                  |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Authentication | string | Bearer token is API key for full access to Avoid Crowds API. Example string for Authentication header: `Bearer {your-token}` |

{% tabs %}
{% tab title="200 Public holidays entries successfully retrieved (short example). Response for request without any query parameters" %}

```
[
    {
        "id": 1,
        "country": "France",
        "name": "New Year's Day (Jour de l'an)",
        "date": "2019-01-01",
        "scope": "National",
        "provinces": null,
        "source": "https://www.legifrance.gouv.fr/affichCode.do?idSectionTA=LEGISCTA000033008129&cidTexte=LEGITEXT000006072050"
    },
    {
        "id": 2,
        "country": "France",
        "name": "Easter Monday (Lundi de Pâques)",
        "date": "2019-04-22",
        "scope": "National",
        "provinces": null,
        "source": "https://www.legifrance.gouv.fr/affichCode.do?idSectionTA=LEGISCTA000033008129&cidTexte=LEGITEXT000006072050"
    },
    {
        "id": 3,
        "country": "France",
        "name": "Labour Day (Fête de Travail)",
        "date": "2019-05-01",
        "scope": "National",
        "provinces": null,
        "source": "https://www.legifrance.gouv.fr/affichCode.do?idSectionTA=LEGISCTA000033008129&cidTexte=LEGITEXT000006072050"
    }
]
```

{% endtab %}

{% tab title="401 Incorrect API token" %}

```
{
    "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403 User was restricted in admin panel" %}

```
{
    "message": "Restricted user"
}
```

{% endtab %}

{% tab title="404 Incorrect address of API route" %}

```
{
    "message": ""
}
```

{% endtab %}

{% tab title="500 Could not find a crowds matching this query." %}

```
{
    "message": "Server Error"
}
```

{% endtab %}
{% endtabs %}

## Get school vacations

<mark style="color:blue;">`GET`</mark> `https://avoid-crowds.dev/api/school_vacations`

#### Query Parameters

| Name                      | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter\[source\_official] | string | Get entries filtered by source official                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| filter\[provinces]        | string | Get entries filtered by provinces                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| filter\[scope]            | string | Get entries filtered by scope                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| filter\[description]      | string | Get entries filtered by name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| filter\[country]          | string | Get entries filtered by country                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| sort                      | string | <p>The sort query parameter is used to determine by which property the results collection will be ordered. Sorting is ascending by default. Adding a hyphen (-) to the start of the property name will reverse the results collection. In case of sorting by multiple fields, write the fields in string format, separated by comma without space. Available fields for sorting: <br><code>description</code><br><code>country</code><br><code>scope</code><br><code>provinces</code></p>                        |
| filter                    | array  | The filter query parameters can be used to filter results by partial property value, exact property value or if a property value exists in a given array of values. There are a lot of flexible filters for crowds below.                                                                                                                                                                                                                                                                                        |
| filter\[date]             | string | <p>Get entries for dates in many differents ways. Format of date: <br><code>Y-m-d</code> (For example, 2019-05-25)<br><code>+</code> (equal to <code>tomorrow</code>)<br><code>-</code> (equal to <code>yesterday</code>)<br><code>ago</code><br><code>first</code><br><code>next</code><br><code>last</code><br><code>this</code><br><code>yesterday</code><br><code>today</code><br>Some date parameter examples:<br><code>next wednesday</code><br><code>last friday</code><br><code>this thursday</code></p> |
| filter\[days\_before]     | string | Get entries before passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| filter\[days\_after]      | string | Get entries after passed day. Format of date is the same as for `filter[date]`                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| filter\[days\_between]    | string | Get entries between two days. Format of dates is the same as for filter\[date]. Two dates must be separated by comma without a space after the comma. Example: `today,next Friday`                                                                                                                                                                                                                                                                                                                               |

#### Headers

| Name           | Type   | Description                                                                                                                  |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Authentication | string | Bearer token is API key for full access to Avoid Crowds API. Example string for Authentication header: `Bearer {your-token}` |

{% tabs %}
{% tab title="200 School vacations entries successfully retrieved (short example). Response for request without any query parameters" %}

```
[
    {
        "id": 1,
        "country": "Australia",
        "description": "Summer Holidays",
        "start_date": "2018-12-14",
        "end_date": "2019-01-28",
        "remark": null,
        "scope": "Limited",
        "provinces": "Northern Territory",
        "source_official": "https://cms.nt.edu.au/_file/szschool/newsletter/31693/attachment/School%20term%20dates%202018%20to%202022.pdf",
        "source_unofficial": null
    },
    {
        "id": 2,
        "country": "Thailand",
        "description": "Christmas Holidays",
        "start_date": "2018-12-15",
        "end_date": "2019-01-06",
        "remark": null,
        "scope": "National",
        "provinces": null,
        "source_official": "http://www.rcis.ac.th/about-the-school/school-calendar/",
        "source_unofficial": null
    },
    {
        "id": 3,
        "country": "Australia",
        "description": "Summer Holidays",
        "start_date": "2018-12-15",
        "end_date": "2019-01-28",
        "remark": null,
        "scope": "Limited",
        "provinces": "South Australia",
        "source_official": "https://www.education.sa.gov.au/teaching/south-australian-state-schools-term-dates?reFlag=1",
        "source_unofficial": null
    },
    {
        "id": 4,
        "country": "South Korea",
        "description": "Winter Holidays",
        "start_date": "2018-12-17",
        "end_date": "2019-01-06",
        "remark": null,
        "scope": "National",
        "provinces": null,
        "source_official": "https://siskorea.org/wp-content/uploads/2017/08/2018-2019-School-Calendar_043018.pdf",
        "source_unofficial": null
    },
    {
        "id": 5,
        "country": "Germany",
        "description": "Christmas Holidays",
        "start_date": "2018-12-19",
        "end_date": "2019-01-04",
        "remark": null,
        "scope": "Limited",
        "provinces": "Sachsen-Anhalt",
        "source_official": "https://www.kmk.org/fileadmin/Dateien/pdf/Ferienkalender/FER18_19.pdf",
        "source_unofficial": null
    }
]
```

{% endtab %}

{% tab title="401 Incorrect API token" %}

```
{
    "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403 User was restricted in admin panel" %}

```
{
    "message": "Restricted user"
}
```

{% endtab %}

{% tab title="404 Incorrect address of API route" %}

```
{
    "message": ""
}
```

{% endtab %}

{% tab title="500 Could not find a crowds matching this query." %}

```
{
    "message": "Server Error"
}
```

{% endtab %}
{% endtabs %}
