forecast エンドポイントは、最大 5 日間の日別の花粉情報を提供し、ユーザーに表示される以下の情報を管理できます。
- 予測日数
- 翻訳されたフィールドの言語コード
- レスポンスのページサイズ
- 特定の地域の植物とそのアレルギーの可能性に関する詳細な情報
API Explorer では、実際のリクエストを実行して、API と API オプションを把握できます。
予測リクエストについて
予測エンドポイントを使用して 1 日分の花粉情報をリクエストするには、次の URL に HTTP GET リクエストを送信します。
https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY
URL にパラメータを含めます。リクエストには、花粉飛散予測を取得する場所、予測日数、レスポンスに含める花粉情報の種類が含まれます。
予測レスポンスを取得する
レスポンス本文には、リクエストされた座標の地域コードと、リクエストされた各日の日別予報情報が含まれます。複数日の情報をリクエストした場合、レスポンスの本文には、情報がリクエストされたページサイズに収まらない場合に次のページを取得するためのトークンも含まれます。
レスポンス本文には、次の 3 つのオブジェクトも含まれます。
DayInfo は、PollenTypeInfo と PlantInfo とともに、対象の予測の日付を提供します。
PollenTypeInfo は、リクエストされた座標で利用可能な花粉の種類(
GRASS
、TREE
、WEED
)、花粉飛散量指数、関連する健康に関する推奨事項の季節性を提供します。PlantInfo は、リクエストされた座標の植物の名前と説明(季節性、外観、交差反応など)を提供します。
基本的なパラメータ
リクエスト例
次のコードは、forecast:lookup リクエストの基本的なリクエストを作成する方法を示しています。この例では、花粉情報の場所と日数を設定します。
curl -X GET "https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY&location.longitude=35.32 &location.latitude=32.32 &days=1"
レスポンスの例
上記の呼び出しにより、次の JSON レスポンスが生成されます。
{ "regionCode": "IL", "dailyInfo": [ { "date": { "year": 2023, "month": 7, "day": 11 }, "pollenTypeInfo": [ { "code": "GRASS", "displayName": "Grass", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] }, { "code": "TREE", "displayName": "Tree", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] }, { "code": "WEED", "displayName": "Weed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] } ], "plantInfo": [ { "code": "BIRCH", "displayName": "Birch", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "TREE", "family": "Betulaceae (the Birch family)", "season": "Late winter, spring", "specialColors": "The bark is usually whitish-gray, silver, orsometimes red." , "specialShapes": "Birch leaves are often triangular with jaggededges. The bark on most birch trees has horizontal dark streaks that look like scoring. Birch tree bark is also , "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oakwell-known for its paper-like texture and peeling nature." pollen. In addition, there may be a higher risk for food allergies like hazelnuts, almonds, peanuts, pears, apples, , "picture": "https://storage.googleapis.com/pollen-pictures/birch_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/birch_closeup.jpg" } }, { "code": "OLIVE", "displayName": "Olive" }, { "code": "GRAMINALES", "displayName": "Grasses", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arecherries and carrots." likely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "GRASS", "family": "Poaceae", "season": "Late spring, summer", "specialColors": "None", "specialShapes": "The leaves are alternate, long and narrow and theleaf margin is smooth." , "crossReaction": "Plantain (Plantago) pollen. In addition, there maybe a higher risk for food allergies like melons, oranges, tomatoes, peanuts, soy, potato, and other legumes." , "picture": "https://storage.googleapis.com/pollen-pictures/graminales_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/graminales_closeup.jpg" } }, { "code": "RAGWEED", "displayName": "Ragweed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 0, "category": "None", "indexDescription": "Pollen levels are very low and are not likelyto trigger allergic reactions" , "color": {} }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "None", "specialShapes": "The leaves are alternate or opposite, divided andlobed. The leaf margin is smooth or serrated." , "crossReaction": "Mugwort and Goldenrod as well as daisies such asSunflower, Dandelion, and Chamomile." , "picture": "https://storage.googleapis.com/pollen-pictures/ragweed_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/ragweed_closeup.jpg" } }, { "code": "ALDER", "displayName": "Alder" }, { "code": "MUGWORT", "displayName": "Mugwort", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "The leaves are green on the upper side andgray-green on the lower side." , "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisiessuch as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, , "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ] }peach, celery and various herbs and spices."
追加のパラメータ
リクエスト例
次のコードは、forecast:lookup のリクエストを作成する方法を示しています。この例では、場所、日数、レスポンス言語を設定し、プラントの説明を削除します。
curl -X GET "https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY&location.longitude=35.32 &location.latitude=32.32 &days=1 &languageCode=fr &plantsDescription=false"
レスポンスの例
上記の呼び出しにより、次の JSON レスポンスが生成されます。
{ "regionCode": "IL", "dailyInfo": [ { "date": { "year": 2023, "month": 7, "day": 11 }, "pollenTypeInfo": [ { "code": "GRASS", "displayName": "Herbacée", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Les niveaux de pollen sont très faibles actuellement. La journéeest idéale pour profiter du grand air !" ] }, { "code": "TREE", "displayName": "Arbre", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Les niveaux de pollen sont très faibles actuellement. La journéeest idéale pour profiter du grand air !" ] }, { "code": "WEED", "displayName": "Herbacées", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Les niveaux de pollen sont très faibles actuellement. La journéeest idéale pour profiter du grand air !" ] } ], "plantInfo": [ { "code": "BIRCH", "displayName": "Bouleau", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } } }, { "code": "OLIVE", "displayName": "Olivier" }, { "code": "GRAMINALES", "displayName": "Graminées", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } } }, { "code": "RAGWEED", "displayName": "Ambroisie", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 0, "category": "Aucun", "indexDescription": "Les niveaux de pollen sont très faibles et ontpeu de risque de déclencher des réactions allergiques." , "color": {} } }, { "code": "ALDER", "displayName": "Aulne" }, { "code": "MUGWORT", "displayName": "Armoise", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Très faible", "indexDescription": "Les personnes extrêmement sensibles au pollensont susceptibles de ressentir des symptômes." , "color": { "green": 0.61960787, "blue": 0.22745098 } } } ] } ] }
ページサイズの上限
リクエスト例
次のコードは、forecast:lookup のリクエストを作成する方法を示しています。この例では、場所、予測日数(この場合は 4 日間)、ページサイズの上限を 1 に設定しています。このリクエストは、最初の日の予測のみを返します。レスポンスには nextPageToken
プロパティが含まれます。このプロパティは、2 回目のリクエストで 4 日目のデータにアクセスするために使用します。
curl -X GET "https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY&location.longitude=35.32 &location.latitude=32.32 &days=4 &pageSize=1"
レスポンスの例
上記の呼び出しは、nextPageToken
を含む次の JSON レスポンスを生成します。2 番目のリクエストで nextPageToken
を使用して、予測の次の日にアクセスします。
{ "regionCode": "IL", "dailyInfo": [ { "date": { "year": 2023, "month": 7, "day": 14 }, "pollenTypeInfo": [ { "code": "GRASS", "displayName": "Grass", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 2, "category": "Low", "indexDescription": "People with high allergy to pollen are likelyto experience symptoms" , "color": { "red": 0.5176471, "green": 0.8117647, "blue": 0.2 } }, "healthRecommendations": [ "It's a good day for outdoor activities since pollen levels arelow." , "Do you know which plants cause your pollen allergy? Check out thepollen data to be prepared." ] }, { "code": "TREE", "displayName": "Tree", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoythe outdoors!" ] }, { "code": "WEED", "displayName": "Weed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] } ], "plantInfo": [ { "code": "BIRCH", "displayName": "Birch", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "TREE", "family": "Betulaceae (the Birch family)", "season": "Late winter, spring", "specialColors": "The bark is usually whitish-gray, silver, orsometimes red." , "specialShapes": "Birch leaves are often triangular with jaggededges. The bark on most birch trees has horizontal dark streaks that look like scoring. Birch tree bark is also , "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oakwell-known for its paper-like texture and peeling nature." pollen. In addition, there may be a higher risk for food allergies like hazelnuts, almonds, peanuts, pears, apples, , "picture": "https://storage.googleapis.com/pollen-pictures/birch_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/birch_closeup.jpg" } }, { "code": "OLIVE", "displayName": "Olive" }, { "code": "GRAMINALES", "displayName": "Grasses", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 2, "category": "Low", "indexDescription": "People with high allergy to pollen are likelycherries and carrots." to experience symptoms" , "color": { "red": 0.5176471, "green": 0.8117647, "blue": 0.2 } }, "plantDescription": { "type": "GRASS", "family": "Poaceae", "season": "Late spring, summer", "specialColors": "None", "specialShapes": "The leaves are alternate, long and narrow and theleaf margin is smooth." , "crossReaction": "Plantain (Plantago) pollen. In addition, there maybe a higher risk for food allergies like melons, oranges, tomatoes, peanuts, soy, potato, and other legumes." , "picture": "https://storage.googleapis.com/pollen-pictures/graminales_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/graminales_closeup.jpg" } }, { "code": "RAGWEED", "displayName": "Ragweed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 0, "category": "None", "indexDescription": "Pollen levels are very low and are not likelyto trigger allergic reactions" , "color": {} }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "None", "specialShapes": "The leaves are alternate or opposite, divided andlobed. The leaf margin is smooth or serrated." , "crossReaction": "Mugwort and Goldenrod as well as daisies such asSunflower, Dandelion, and Chamomile." , "picture": "https://storage.googleapis.com/pollen-pictures/ragweed_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/ragweed_closeup.jpg" } }, { "code": "ALDER", "displayName": "Alder" }, { "code": "MUGWORT", "displayName": "Mugwort", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "The leaves are green on the upper side andgray-green on the lower side." , "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisiessuch as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, , "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ], "nextPageToken": "CAESdApadHlwZS5nb29nbGVhcGlzLm..." }peach, celery and various herbs and spices."
ページ 2 にアクセスするには、リクエストに nextPageToken
を挿入します。レスポンスには nextPageToken
が含まれます。これを使用して、予測の 3 日目にアクセスできます。
curl -X GET "https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY&location.longitude=35.32 &location.latitude=32.32 &days=4 &pageSize=1 &pageToken=CAESdApadHlwZS5nb29nbGVhcGlzLm..."
レスポンスには、花粉飛散予報の 2 日目に関する情報が含まれます。
{ "regionCode": "IL", "dailyInfo": [ { "date": { "year": 2023, "month": 7, "day": 15 }, "pollenTypeInfo": [ { "code": "GRASS", "displayName": "Grass", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 2, "category": "Low", "indexDescription": "People with high allergy to pollen are likely to experience symptoms", "color": { "red": 0.5176471, "green": 0.8117647, "blue": 0.2 } }, "healthRecommendations": [ "It's a good day for outdoor activities since pollen levels are low.", "Do you know which plants cause your pollen allergy? Check out thepollen data to be prepared." ] }, { "code": "TREE", "displayName": "Tree", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] }, { "code": "WEED", "displayName": "Weed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "healthRecommendations": [ "Pollen levels are very low right now. It's a great day to enjoy theoutdoors!" ] } ], "plantInfo": [ { "code": "BIRCH", "displayName": "Birch", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "TREE", "family": "Betulaceae (the Birch family)", "season": "Late winter, spring", "specialColors": "The bark is usually whitish-gray, silver, orsometimes red." , "specialShapes": "Birch leaves are often triangular with jagged edges.The bark on most birch trees has horizontal dark streaks that look like scoring. Birch tree bark is also , "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oakwell-known for its paper-like texture and peeling nature." pollen. In addition, there may be a higher risk for food allergies like hazelnuts, almonds, peanuts, pears, apples, cherries and carrots." , "picture": "https://storage.googleapis.com/pollen-pictures/birch_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/birch_closeup.jpg" } }, { "code": "OLIVE", "displayName": "Olive" }, { "code": "GRAMINALES", "displayName": "Grasses", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 2, "category": "Low", "indexDescription": "People with high allergy to pollen are likelyto experience symptoms" , "color": { "red": 0.5176471, "green": 0.8117647, "blue": 0.2 } }, "plantDescription": { "type": "GRASS", "family": "Poaceae", "season": "Late spring, summer", "specialColors": "None", "specialShapes": "The leaves are alternate, long and narrow and theleaf margin is smooth." , "crossReaction": "Plantain (Plantago) pollen. In addition, there maybe a higher risk for food allergies like melons, oranges, tomatoes, peanuts, soy, potato, and other legumes." , "picture": "https://storage.googleapis.com/pollen-pictures/graminales_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/graminales_closeup.jpg" } }, { "code": "RAGWEED", "displayName": "Ragweed", "inSeason": true, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 0, "category": "None", "indexDescription": "Pollen levels are very low and are not likelyto trigger allergic reactions" , "color": {} }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "None", "specialShapes": "The leaves are alternate or opposite, divided andlobed. The leaf margin is smooth or serrated." , "crossReaction": "Mugwort and Goldenrod as well as daisies such asSunflower, Dandelion, and Chamomile." , "picture": "https://storage.googleapis.com/pollen-pictures/ragweed_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/ragweed_closeup.jpg" } }, { "code": "ALDER", "displayName": "Alder" }, { "code": "MUGWORT", "displayName": "Mugwort", "inSeason": false, "indexInfo": { "code": "UPI", "displayName": "Universal Pollen Index", "value": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen arelikely to experience symptoms" , "color": { "green": 0.61960787, "blue": 0.22745098 } }, "plantDescription": { "type": "WEED", "family": "Asteraceae (the daisy family)", "season": "Late summer, fall", "specialColors": "The leaves are green on the upper side andgray-green on the lower side." , "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisiessuch as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, , "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ], "nextPageToken": "CAISdApadHlwZS5nb29nbGVhcGlzLm..." }peach, celery and various herbs and spices."