# Resource Inclusion

When a response is returned it will not automatically include extra data from other resources/models. It will only list the resource type and id. eg.

```
    "competition" : {
        "resourceType" : "competitions",
        "id" : "009e9276-5c80-11e8-9c2d-fa7ae01bbebc"
    },
```

If specified in the query string the `include` parameter will expand that resource in the *includes* section of the response. The `include` parameter takes a comma separated list of resourceTypes to be included.

```
/v1/hockey/org/1/teams/009e9276-5c80-11e8-9c2d-fa7ae01bbebc?include=competitions,leagues
```

If the resourceType is included in the parameter and that resourceType is available in the response, then response will include an *includes* key. Inside that *includes* key is a *resources* object. Inside that object, there are keys for each type of included resourceType. Inside each resourceType keyed against the id is an object representing that resource.

```
{
    "meta": ...
    "links": ...
    "data": ...
    "includes": {
        "resources": {
            "competitions":
                "009e9276-5c80-11e8-9c2d-fa7ae01bbebc": {
                    ...
                    Competition Resource Details
                    ...        
                }
            },
            "leagues": {
                "009e9276-5c80-11e8-9c2d-fa7bc24e4ebc": {
                    ...
                    League Resource Details
                    ...        
                }
            }
        }
    }
}
```

If the resourceType/id block is not available in the response, then the `include` will not link in the requested resource. eg. an `include=competitions` in a fixtures call will not return anything as the competition resource is not returned in these calls. However, the include functionality also checks the included resources for resourceType/id blocks. This means that you can chain includes to get further along the data model. For example an `include=competitions,seasons` in a fixtures call will return the competition resource as the competition resourceType/id block is returned in the season resource.

The list of available inclusions are

| code            | Resource      |
| --------------- | ------------- |
| `competitions`  | Competitions  |
| `entities`      | Teams         |
| `entityGroups`  | Clubs         |
| `fixtures`      | Matches       |
| `leagues`       | Leagues       |
| `organizations` | Organizations |
| `persons`       | Persons       |
| `sites`         | Sites         |
| `seasons`       | Seasons       |
| `seasonPools`   | Pools         |
| `seasonStages`  | Stages        |
| `seasonRounds`  | Rounds        |
| `venues`        | Venues        |
