Click or drag to resize

DataApiGetLocationInfo Method

A lightweight alternative to GetLocationData(LocationDataRequest) that returns info about the station(s) that would be used to satisfy an equivalent LocationDataRequest, but not the data itself.

Namespace: DegreeDays.Api.Data
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public LocationInfoResponse GetLocationInfo(
	LocationInfoRequest request
)

Parameters

request  LocationInfoRequest
specifies the location you want data for and the data that you want (as this can affect the station-selection process for geographic locations). Cannot be null.

Return Value

LocationInfoResponse
A non-null LocationInfoResponse containing info about the station(s) that would be used to satisfy an equivalent LocationDataRequest.
Exceptions
ExceptionCondition
LocationExceptionThe request failed because of problems relating to the specified Location.
ServiceExceptionThe request failed because of a problem with the API service (sorry!).
RateLimitExceptionYou hit the RateLimit for your account's plan, and need to wait a little while before it's reset.
InvalidRequestExceptionThe request that is sent to the API servers is invalid (e.g. it is authenticated with invalid API access keys).
TransportExceptionA problem sending the request to the API servers, or a problem getting the API's response back.
DegreeDaysApiExceptionThe superclass of all the exceptions listed above.
ArgumentNullExceptionrequest is null.
Remarks

This can be useful if you have a database of data stored by station ID, but are using geographic locations (postal/zip codes or longitude/latitude positions) to determine which station ID to use for each of your real-world locations. A LocationInfoRequest only requires one request unit, whilst a large LocationDataRequest requires considerably more, so it often makes sense to use this to avoid the overhead of re-fetching data that you already have stored. We call this "two-stage data fetching", and you can read more about it in the remarks for the GeographicLocation class.

Note, however, that this returns nothing that isn't also returned by a call to GetLocationData(LocationDataRequest). So, if you know you'll be fetching data anyway, you might as well use GetLocationData(LocationDataRequest) from the start.

Exceptions and data availability:

The exceptions thrown by this method are the same as those thrown by GetLocationData(LocationDataRequest), and they are thrown under exactly the same circumstances.

However, because this doesn't return any data (i.e. no DataSets), there's no way to tell from this whether an equivalent LocationDataResponse would actually contain any or all of the data you want. So, although you can use this to determine what station ID the API would use for an equivalent call to GetLocationData(LocationDataRequest), you would have to actually make that call to be sure that you could get all the data you wanted.

Version History
VersionDescription
1.1 This was added in version 1.1.
See Also