悪天候時の警告
このセクションでは、特定の場所での厳しい気象警報のクエリーの例を示します。
注 : この例では、 HERE トークンを使用して要求を認証します。 使用可能な認証オプションについては、『 Identity & Access Management 開発者ガイド』を参照してください。
ユーザーストーリー
ユーザーが、ミネソタ州ダルースの気象警報を取得しようとしています。
リクエストのサマリー
リクエスト
次のコードブロックは、応答データを JSON で配信するように指定して、リクエスト全体を示しています。
curl https://weather.cc.api.here.com/weather/1.0/report.json
?product=alerts
&name=Duluth
-H "Authorization: Bearer {YOUR_TOKEN}"
HERE は、応答データが XML で配信されることを示す同じ要求です。
curl https://weather.cc.api.here.com/weather/1.0/report.xml
?product=alerts
&name=Duluth
-H "Authorization: Bearer {YOUR_TOKEN}"
レスポンス
リクエストに対する応答には、次の内容が含まれます。
- 水曜日の朝、火曜日の夜の厳しい気象警報です
JSON 形式の応答例は次のとおりです。
{
"alerts": {
"alerts": [
{
"timeSegment": [
{
"value": "",
"segment": "N",
"otherAttributes": {},
"day_of_week": "3"
},
{
"value": "",
"segment": "M",
"otherAttributes": {},
"day_of_week": "4"
}
],
"type": "17",
"description": "Wind chill alert"
}
],
"country": "United States",
"state": "Minnesota",
"city": "Duluth",
"latitude": 46.78327,
"longitude": -92.10658,
"timezone": -6
},
"feedCreation": "2013-12-10T14:59:31.188",
"metric": true
}
XML 形式の応答例は次のとおりです。
<WeatherReport>
<alerts timezone="-6" longitude="-92.10658" latitude="46.78327" city="Duluth" state="Minnesota" country="United States">
<alerts>
<timeSegment day_of_week="3" segment="N"/>
<timeSegment day_of_week="4" segment="M"/>
<type>17</type>
<description>Wind chill alert</description>
</alerts>
</alerts>
<feedCreation>2013-12-10T14:58:43.911Z</feedCreation>
<metric>true</metric>
</WeatherReport>
このタイプのリクエストへの応答の詳細については、「返信をレポート」を参照してください。