Skip to content

Latest commit

 

History

History
195 lines (138 loc) · 4.63 KB

CountriesApi.md

File metadata and controls

195 lines (138 loc) · 4.63 KB

Sportmonks\CountriesApi

All URIs are relative to https://api.sportmonks.com, except if the operation defines another base path.

Method HTTP request Description
all() GET /{version}/core/countries All
getById() GET /{version}/core/countries/{countryId} By ID
search() GET /{version}/core/countries/search/{name} Search

all()

all($version): \Sportmonks\Model\CountriesAllResponse

All

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$sportmonks = new \Sportmonks\Client(
    version: "v3",
    sport: "football",
    apiKey: "AUTHORIZATION",
);

$version = "v3"; // The version of the API.

try {
    $result = $sportmonks->countries->all(
        version: $version
    );
    print_r($result->$getData());
    print_r($result->$getPagination());
    print_r($result->$getSubscription());
    print_r($result->$getRateLimit());
    print_r($result->$getTimezone());
} catch (\Exception $e) {
    echo 'Exception when calling CountriesApi->all: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
version string The version of the API. [optional]

Return type

\Sportmonks\Model\CountriesAllResponse

Authorization

apikeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getById()

getById($country_id, $version): \Sportmonks\Model\CountriesGetByIdResponse

By ID

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$sportmonks = new \Sportmonks\Client(
    version: "v3",
    sport: "football",
    apiKey: "AUTHORIZATION",
);

$country_id = 1161; // The ID of the country you want to retrieve.
$version = "v3"; // The version of the API.

try {
    $result = $sportmonks->countries->getById(
        country_id: $country_id, 
        version: $version
    );
    print_r($result->$getData());
    print_r($result->$getSubscription());
    print_r($result->$getRateLimit());
    print_r($result->$getTimezone());
} catch (\Exception $e) {
    echo 'Exception when calling CountriesApi->getById: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
country_id int The ID of the country you want to retrieve.
version string The version of the API. [optional]

Return type

\Sportmonks\Model\CountriesGetByIdResponse

Authorization

apikeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

search()

search($name, $version): \Sportmonks\Model\CountriesSearchResponse

Search

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$sportmonks = new \Sportmonks\Client(
    version: "v3",
    sport: "football",
    apiKey: "AUTHORIZATION",
);

$name = "Fra"; // The name you want to search on
$version = "v3"; // The version of the API.

try {
    $result = $sportmonks->countries->search(
        name: $name, 
        version: $version
    );
    print_r($result->$getData());
    print_r($result->$getPagination());
    print_r($result->$getSubscription());
    print_r($result->$getRateLimit());
    print_r($result->$getTimezone());
} catch (\Exception $e) {
    echo 'Exception when calling CountriesApi->search: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
name string The name you want to search on
version string The version of the API. [optional]

Return type

\Sportmonks\Model\CountriesSearchResponse

Authorization

apikeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]