Selecting Fields
When you make a request to the API, you can specify which fields you want to include in the response. This can be useful if you only need a subset of the fields, or if you want to reduce the size of the response.
Field selection
To select fields, you can use the fields query parameter. This parameter takes a comma-separated list of field names that you want to include in the response. For example, if you want to include only the id and name fields, you can make a request like this:
https://myapi.sports.uz/v1/countries?fields=id,name
{
"data": [
{
"id": 1,
"name": "Afghanistan"
},
{
"id": 2,
"name": "Albania"
},
...
]
}
Including nested fields
You can also include nested fields by using dot notation. Get the nested field by specifying the parent field name followed by a dot and the nested field name.
Expand the nested field by using the expand query parameter.
For example, if you want to include the continent field in the response, you can make a request like this:
https://myapi.sports.uz/v1/countries?expand=continent
{
"data": [
{
"id": 1,
"name": "Afghanistan",
"continent": {
"id": 1,
"name": "Europe",
"code": "EU"
}
}
...
]
}