# 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/baseball/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        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sportradar.com/datacore/sports-apis/baseball/datacore-api-v1/introduction/resource-inclusion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
