Weather.GetWeathers Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a paginated list of weather data.
public virtual Azure.Pageable<BinaryData> GetWeathers (string partyId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = default, DateTimeOffset? endDateTime = default, int? maxPageSize = default, string skipToken = default, Azure.RequestContext context = default);
abstract member GetWeathers : string * string * string * string * string * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
override this.GetWeathers : string * string * string * string * string * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Nullable<int> * string * Azure.RequestContext -> Azure.Pageable<BinaryData>
Public Overridable Function GetWeathers (partyId As String, boundaryId As String, extensionId As String, weatherDataType As String, granularity As String, Optional startDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional endDateTime As Nullable(Of DateTimeOffset) = Nothing, Optional maxPageSize As Nullable(Of Integer) = Nothing, Optional skipToken As String = Nothing, Optional context As RequestContext = Nothing) As Pageable(Of BinaryData)
Parameters
- partyId
- String
Party ID.
- boundaryId
- String
Boundary ID.
- extensionId
- String
ID of the weather extension.
- weatherDataType
- String
Type of weather data (forecast/historical).
- granularity
- String
Granularity of weather data (daily/hourly).
- startDateTime
- Nullable<DateTimeOffset>
Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ.
- endDateTime
- Nullable<DateTimeOffset>
Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ.
Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50.
- skipToken
- String
Skip token for getting next set of results.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The Pageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
partyId
, boundaryId
, extensionId
, weatherDataType
or granularity
is null.
Service returned a non-success status code.
Examples
This sample shows how to call GetWeathers with required parameters and parse the result.
var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetWeatherClient(<2022-11-01-preview>);
foreach (var data in client.GetWeathers("<partyId>", "<boundaryId>", "<extensionId>", "<weatherDataType>", "<granularity>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("partyId").ToString());
Console.WriteLine(result.GetProperty("boundaryId").ToString());
Console.WriteLine(result.GetProperty("extensionId").ToString());
Console.WriteLine(result.GetProperty("location").GetProperty("latitude").ToString());
Console.WriteLine(result.GetProperty("location").GetProperty("longitude").ToString());
Console.WriteLine(result.GetProperty("dateTime").ToString());
Console.WriteLine(result.GetProperty("extensionVersion").ToString());
Console.WriteLine(result.GetProperty("weatherDataType").ToString());
Console.WriteLine(result.GetProperty("granularity").ToString());
}
This sample shows how to call GetWeathers with all parameters, and how to parse the result.
var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetWeatherClient(<2022-11-01-preview>);
foreach (var data in client.GetWeathers("<partyId>", "<boundaryId>", "<extensionId>", "<weatherDataType>", "<granularity>", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234, "<skipToken>"))
{
JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("partyId").ToString());
Console.WriteLine(result.GetProperty("boundaryId").ToString());
Console.WriteLine(result.GetProperty("extensionId").ToString());
Console.WriteLine(result.GetProperty("location").GetProperty("latitude").ToString());
Console.WriteLine(result.GetProperty("location").GetProperty("longitude").ToString());
Console.WriteLine(result.GetProperty("dateTime").ToString());
Console.WriteLine(result.GetProperty("unitSystemCode").ToString());
Console.WriteLine(result.GetProperty("extensionVersion").ToString());
Console.WriteLine(result.GetProperty("weatherDataType").ToString());
Console.WriteLine(result.GetProperty("granularity").ToString());
Console.WriteLine(result.GetProperty("cloudCover").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("cloudCover").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("dewPoint").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("dewPoint").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("growingDegreeDay").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("growingDegreeDay").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("precipitation").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("precipitation").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("pressure").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("pressure").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("relativeHumidity").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("relativeHumidity").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("soilMoisture").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("soilMoisture").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("soilTemperature").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("soilTemperature").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("temperature").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("temperature").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("visibility").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("visibility").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("wetBulbTemperature").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("wetBulbTemperature").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("windChill").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("windChill").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("windDirection").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("windDirection").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("windGust").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("windGust").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("windSpeed").GetProperty("unit").ToString());
Console.WriteLine(result.GetProperty("windSpeed").GetProperty("value").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("eTag").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("modifiedDateTime").ToString());
Console.WriteLine(result.GetProperty("properties").GetProperty("<test>").ToString());
}
Remarks
Below is the JSON schema for one item in the pageable response.
Response Body:
Schema for WeatherDataListResponseValue
:
{
partyId: string, # Required. Party ID.
boundaryId: string, # Required. Boundary ID.
extensionId: string, # Required. ID of the weather extension.
location: {
latitude: number, # Required. Latitude of the location.
longitude: number, # Required. Longitude of the location.
}, # Required. Location model class.
dateTime: string (ISO 8601 Format), # Required. Date-time of the weather data, sample format: yyyy-MM-ddTHH:mm:ssZ.
unitSystemCode: string, # Optional. Unit System like US/SI etc.
extensionVersion: string, # Required. Version of the weather data extension.
weatherDataType: string, # Required. Type of weather data (forecast/historical).
granularity: string, # Required. Granularity of weather data (daily/hourly).
cloudCover: {
unit: string, # Optional. Data unit.
value: number, # Optional. Data value.
}, # Optional. Schema for storing measurement reading and unit.
dewPoint: Measure, # Optional. Schema for storing measurement reading and unit.
growingDegreeDay: Measure, # Optional. Schema for storing measurement reading and unit.
precipitation: Measure, # Optional. Schema for storing measurement reading and unit.
pressure: Measure, # Optional. Schema for storing measurement reading and unit.
relativeHumidity: Measure, # Optional. Schema for storing measurement reading and unit.
soilMoisture: Measure, # Optional. Schema for storing measurement reading and unit.
soilTemperature: Measure, # Optional. Schema for storing measurement reading and unit.
temperature: Measure, # Optional. Schema for storing measurement reading and unit.
visibility: Measure, # Optional. Schema for storing measurement reading and unit.
wetBulbTemperature: Measure, # Optional. Schema for storing measurement reading and unit.
windChill: Measure, # Optional. Schema for storing measurement reading and unit.
windDirection: Measure, # Optional. Schema for storing measurement reading and unit.
windGust: Measure, # Optional. Schema for storing measurement reading and unit.
windSpeed: Measure, # Optional. Schema for storing measurement reading and unit.
id: string, # Optional. Weather data ID.
eTag: string, # Optional. The ETag value to implement optimistic concurrency.
createdDateTime: string (ISO 8601 Format), # Optional. Date-time when resource was created, sample format: yyyy-MM-ddTHH:mm:ssZ.
modifiedDateTime: string (ISO 8601 Format), # Optional. Date-time when resource was last modified, sample format: yyyy-MM-ddTHH:mm:ssZ.
properties: Dictionary<string, any>, # Optional. A collection of key value pairs that belongs to the resource.
Each pair must not have a key greater than 50 characters
and must not have a value greater than 250 characters.
Note: A maximum of 25 key value pairs can be provided for a resource and only string and numeral values are supported.
}
Applies to
Azure SDK for .NET