次の方法で共有


Weather.GetWeathers メソッド

定義

気象データのページ分割されたリストを返します。

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)

パラメーター

partyId
String

パーティ ID。

boundaryId
String

境界 ID。

extensionId
String

天気予報拡張機能の ID。

weatherDataType
String

気象データの種類 (予測/履歴)。

granularity
String

気象データの粒度 (日単位/時間単位)。

startDateTime
Nullable<DateTimeOffset>

気象データの開始 UTC 日時 (含む)、サンプル形式: yyyy-MM-ddTHH:mm:ssZ。

endDateTime
Nullable<DateTimeOffset>

気象データの終了 UTC 日時 (含む)、サンプル形式: yyyy-MM-ddTHH:mm:ssZ。

maxPageSize
Nullable<Int32>

必要な項目の最大数 (含む)。 Minimum = 10、Maximum = 1000、既定値 = 50。

skipToken
String

次の結果セットを取得するためのトークンをスキップします。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

Pageable<T>オブジェクトの一覧を含むサービスの BinaryData 。 コレクション内の各項目の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

partyIdboundaryIdextensionIdweatherDataType または granularity が null です。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して GetWeathers を呼び出し、結果を解析する方法を示します。

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());
}

このサンプルでは、すべてのパラメーターを使用して GetWeathers を呼び出す方法と、結果を解析する方法を示します。

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());
}

注釈

ページング可能な応答の 1 つの項目の JSON スキーマを次に示します。

応答本文:

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.
}

適用対象