預測 端點提供最多 5 天的投票資訊。您可以控制 使用者會看到下列資訊:
- 預測天數
- 已翻譯欄位的語言代碼
- 回應頁面大小
- 特定區域內植物及其過敏原的詳細資訊 潛在
API Explorer 可讓您發出即時要求,以便更熟悉 API 和 API 選項:
預測請求簡介
如要使用預測端點來要求每日花粉資訊,請傳送 HTTP GET 要求到:
https://pollen.googleapis.com/v1/forecast:lookup?key=YOUR_API_KEY
在 網址。請求中包含您要取得 花粉指數、預報天數,以及要納入的花粉資訊 回應。
關於預測回應
回應 內文 提供了所要求座標的區碼和每日天氣預報 所需的每日資訊如果您索取多個資訊 時,回應主體也會包含擷取下一頁的權杖,如果 不符合要求的網頁大小。
回應主體還包含三個物件:
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 the outdoors!" ] }, { "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 are likely 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 the 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 are likely 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 the outdoors!" ] } ], "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 are likely 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, or sometimes 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 well-known for its paper-like texture and peeling nature.", "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oak 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": 1, "category": "Very Low", "indexDescription": "People with very high allergy to pollen are 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 the leaf margin is smooth.", "crossReaction": "Plantain (Plantago) pollen. In addition, there may be 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 likely to 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 and lobed. The leaf margin is smooth or serrated.", "crossReaction": "Mugwort and Goldenrod as well as daisies such as Sunflower, 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 are likely 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 and gray-green on the lower side.", "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisies such as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, peach, celery and various herbs and spices.", "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ] }
其他參數
要求範例
下列程式碼顯示如何建構 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ée est 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 pollen sont 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ée est 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 pollen sont 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ée est 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 pollen sont 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 pollen sont 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 ont peu 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 pollen sont 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"
回應範例
上述呼叫會產生下列 JSON 回應,包括
nextPageToken
。在第二個要求中使用 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 are low.", "Do you know which plants cause your pollen allergy? Check out the pollen 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 are likely 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 the 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 are likely 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 the outdoors!" ] } ], "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 are likely 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, or sometimes 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 well-known for its paper-like texture and peeling nature.", "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oak 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 likely 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 the leaf margin is smooth.", "crossReaction": "Plantain (Plantago) pollen. In addition, there may be 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 likely to 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 and lobed. The leaf margin is smooth or serrated.", "crossReaction": "Mugwort and Goldenrod as well as daisies such as Sunflower, 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 are likely 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 and gray-green on the lower side.", "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisies such as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, peach, celery and various herbs and spices.", "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ], "nextPageToken": "CAESdApadHlwZS5nb29nbGVhcGlzLm..." }
如要存取第 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 are likely 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 the 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 are likely 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 the outdoors!" ] } ], "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 are likely 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, or sometimes 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 well-known for its paper-like texture and peeling nature.", "crossReaction": "Alder, Hazel, Hornbeam, Beech, Willow, and Oak 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 likely 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 the leaf margin is smooth.", "crossReaction": "Plantain (Plantago) pollen. In addition, there may be 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 likely to 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 and lobed. The leaf margin is smooth or serrated.", "crossReaction": "Mugwort and Goldenrod as well as daisies such as Sunflower, 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 are likely 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 and gray-green on the lower side.", "specialShapes": "The leaves are alternate, divided and pinnate.", "crossReaction": "Ragweed and Goldenrod pollen as well as daisies such as Sunflower, Dandelion and Chamomile. In addition, there may be a higher risk for food allergies like mustard, peach, celery and various herbs and spices.", "picture": "https://storage.googleapis.com/pollen-pictures/mugwort_full.jpg", "pictureCloseup": "https://storage.googleapis.com/pollen-pictures/mugwort_closeup.jpg" } } ] } ], "nextPageToken": "CAISdApadHlwZS5nb29nbGVhcGlzLm..." }