A list of all methods in the AutocompleteLocationLookupService service. Click on the method name to view detailed information about that method.
| Methods | Description |
|---|---|
| autocomplete | The weatherstack API's location autocomplete endpoint can be used to pinpoint one or more specific locations and their identifying response objects with the aim of later passing them to a weather data endpoint. In our example below, we are looking for London, United Kingdom. A successful API request will return one or multiple results that match your search query. In our example, the first array object (London, United Kingdom) contains the correct result. Now that we have our identifying response objects of the target location we were looking for, we can make sure that the correct location is used by other API endpoints by using one of the available location identifiers (ideally: lat and lon) for upcoming queries. |
The weatherstack API's location autocomplete endpoint can be used to pinpoint one or more specific locations and their identifying response objects with the aim of later passing them to a weather data endpoint. In our example below, we are looking for London, United Kingdom. A successful API request will return one or multiple results that match your search query. In our example, the first array object (London, United Kingdom) contains the correct result. Now that we have our identifying response objects of the target location we were looking for, we can make sure that the correct location is used by other API endpoints by using one of the available location identifiers (ideally: lat and lon) for upcoming queries.
- HTTP Method:
GET - Endpoint:
/autocomplete
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| access_key | str | ✅ | [Required] Use this parameter to pass your unique API access key to the API. |
| query | str | ❌ | [Required] Use this parameter to pass your location search/autocomplete query to the API in free-text. |
Return Type
AutocompleteOkResponse
Example Usage Code Snippet
from weatherstack import Weatherstack, Environment
sdk = Weatherstack(
base_url=Environment.DEFAULT.value
)
result = sdk.autocomplete_location_lookup.autocomplete(
access_key="YOUR_ACCESS_KEY",
query="london"
)
print(result)