通过 预测数据 端点最多提供 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
,您随后可以使用它来访问
预测。
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..." }