你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Weather Data - Get
返回 WeatherData 的列表。
POST {endpoint}/weather-data:fetch?api-version=2023-11-01-preview
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
endpoint
|
path | True |
string uri |
命名空间的主机名,例如 admaInstanceName.farmbeats.azure.net |
api-version
|
query | True |
string |
请求的 API 版本 |
请求头
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
Authorization | True |
string |
请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。 |
请求正文
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
extensionApiName | True |
string |
要向其发出请求的扩展 API 名称。 |
extensionId | True |
string |
要用于 providerInput 的扩展的 ID。 例如 DTN。ClearAg。 |
units | True |
string |
要向其发送数据提供程序请求的单位。 支持的值为“e”(英语单位),“m”表示指标单位,“h”表示混合单位 (英国) ,“s”表示指标 SI 单位。 |
additionalParams |
天气数据提供程序请求的其他参数的架构。 |
||
credentials |
基于 API 密钥的身份验证的 Api 密钥身份验证凭据类。 |
||
duration |
integer |
指定返回每日预测响应的天数。 可用值为 1、5、10、25 和 45。 (仅适用于 Azure 天气地图扩展。) |
|
endTimeHours |
integer |
时间范围的结束时间。 (仅适用于 DTN。ClearAg extension.) |
|
language |
string |
语言 (IETF BCP 47 语言标记) ,其中数据提供程序应返回搜索结果。 示例:“en-US”、“es”、“es-MX”、“fr-FR”。 |
|
locations |
需要从提供程序提取天气数据的位置列表。 |
||
startTimeHours |
integer |
时间范围的开始时间。 小时 0 表示当前小时。 (仅适用于 DTN。ClearAg extension.) |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
Success |
|
Other Status Codes |
错误 Headers x-ms-error-code: string |
安全性
Authorization
请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。
Type:
apiKey
In:
header
示例
WeatherData_Get
Sample Request
POST {endpoint}/weather-data:fetch?api-version=2023-11-01-preview
{
"extensionId": "IBM.TWC",
"extensionApiName": "currents-on-demand",
"locations": [
{
"type": "LatLong",
"value": "33,-97"
}
],
"language": "en-US",
"units": "e",
"credentials": {
"kind": "ApiKeyAuthCredentials",
"apiKey": {
"keyVaultUri": "https://<keyvaultname>.vault.azure.net/",
"keyName": "string",
"keyVersion": "string"
}
}
}
Sample Response
{
"weatherMetadata": {
"extensionVersion": "1.0",
"weatherDataType": "current",
"extensionId": "IBM.TWC",
"extensionApiName": "currents-on-demand",
"units": "e"
},
"status": "Succeeded",
"locations": [
{
"location": {
"type": "LatLong",
"value": "33,-97"
},
"lastRefreshedDateTime": "2023-02-09T13:02:20Z",
"data": {
"dayOfWeek": [
"Wednesday"
],
"dayOrNight": [
"Night"
],
"pressureMeanSeaLevel": {
"unit": "inches of mercury",
"value": [
1021.1
]
},
"relativeHumidity": {
"unit": "percentage",
"value": [
84
]
},
"temperature": {
"unit": "fahrenheit",
"value": [
49
]
},
"temperatureDewPoint": {
"unit": "fahrenheit",
"value": [
44
]
},
"temperatureFeelsLike": {
"unit": "fahrenheit",
"value": [
47
]
},
"temperatureHeatIndex": {
"unit": "fahrenheit",
"value": [
49
]
},
"temperatureWindChill": {
"unit": "fahrenheit",
"value": [
47
]
},
"uvDescription": [
"Low"
],
"uvIndex": [
0
],
"visibility": {
"unit": "miles",
"value": [
10
]
},
"windDirection": {
"unit": "degree",
"value": [
150
]
},
"windGust": {
"unit": "miles/hour",
"value": [
0
]
},
"windSpeed": {
"unit": "miles/hour",
"value": [
4
]
},
"additionalAttributes": {
"cloudCoverPhrase": [
"Partly Cloudy"
]
}
}
}
],
"errors": {
"locations": []
}
}
定义
名称 | 说明 |
---|---|
Additional |
天气数据提供程序请求的其他参数的架构。 |
Api |
基于 API 密钥的身份验证的 Api 密钥身份验证凭据类。 |
Auth |
支持的不同类型的 AuthCredential 的枚举。 |
Error |
Azure AgPlatform 服务出错。 |
Error |
失败位置的错误信息模型。 |
Error |
来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。 |
Inner |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
Key |
密钥保管库的属性。 |
Location |
位置类型,例如 LatLong/IataCode/IcaoCode/Placeid/PostalKey。 |
Measures |
用于存储度量读数和单位的架构。 |
Status |
指示成功、失败或部分成功响应。 |
Weather |
针对所有失败位置遇到的错误的模型。 |
Weather |
天气数据的架构。 |
Weather |
天气数据提供程序请求的架构。 |
Weather |
天气数据提供程序响应的架构。 |
Weather |
位置数据的架构。 |
Weather |
WeatherLocationData 数据的架构。 |
Weather |
天气元数据的架构。 |
AdditionalProviderParameters
天气数据提供程序请求的其他参数的架构。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
details |
boolean |
True |
详细信息 (仅适用于 AzureWeatherMaps) 。 |
iconResolution |
string |
图标 解析 (仅适用于 AzureWeatherMaps) 。 |
ApiKeyAuthCredentials
基于 API 密钥的身份验证的 Api 密钥身份验证凭据类。
名称 | 类型 | 说明 |
---|---|---|
apiKey |
密钥保管库的属性。 |
|
kind | string: |
支持的不同类型的 AuthCredential 的枚举。 |
AuthCredentialsKind
支持的不同类型的 AuthCredential 的枚举。
名称 | 类型 | 说明 |
---|---|---|
ApiKeyAuthCredentials |
string |
|
OAuthClientCredentials |
string |
Error
Azure AgPlatform 服务出错。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
服务器定义的错误代码集。 |
details |
Error[] |
有关导致此报告错误的特定错误的详细信息数组。 |
innererror |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
|
message |
string |
错误的用户可读表示形式。 |
target |
string |
错误的目标。 |
ErrorForLocation
失败位置的错误信息模型。
名称 | 类型 | 说明 |
---|---|---|
code |
integer |
数据提供程序返回的状态代码。 |
description |
string |
错误的说明。 |
location |
位置数据的架构。 |
|
retryable |
boolean |
指示是否应尝试使用相同的请求正文进行重试以提取所需数据的标志。 |
ErrorResponse
来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。
名称 | 类型 | 说明 |
---|---|---|
error |
Azure AgPlatform 服务出错。 |
|
traceId |
string |
唯一跟踪 ID。 |
InnerError
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
包含错误提供的特定错误代码。 |
innererror |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
KeyVaultProperties
密钥保管库的属性。
名称 | 类型 | 说明 |
---|---|---|
keyName |
string |
密钥保管库项的名称。 |
keyVaultUri |
string |
密钥保管库的 URI。 |
keyVersion |
string |
密钥保管库密钥的版本。 |
LocationType
位置类型,例如 LatLong/IataCode/IcaoCode/Placeid/PostalKey。
名称 | 类型 | 说明 |
---|---|---|
IataCode |
string |
|
IcaoCode |
string |
|
LatLong |
string |
|
PlaceId |
string |
|
PostalKey |
string |
Measures
用于存储度量读数和单位的架构。
名称 | 类型 | 说明 |
---|---|---|
unit |
string |
数据单位。 |
value |
number[] |
数据值。 |
Status
指示成功、失败或部分成功响应。
名称 | 类型 | 说明 |
---|---|---|
Failed |
string |
|
PartiallySucceeded |
string |
|
Succeeded |
string |
WeatherDataErrors
针对所有失败位置遇到的错误的模型。
名称 | 类型 | 说明 |
---|---|---|
locations |
所有失败位置遇到的错误列表。 |
WeatherDataForPassthrough
天气数据的架构。
名称 | 类型 | 说明 |
---|---|---|
additionalAttributes |
属于资源的键值对的集合。 每对的键不能超过 50 个字符,并且值不能大于 250 个字符。 注意:最多可以为资源提供 100 个键值对,并且仅支持字符串和数字值。 |
|
cloudCover |
用于存储度量读数和单位的架构。 |
|
dayOfWeek |
string[] |
一周中的某一天。 |
dayOrNight |
string[] |
此数据字段根据位置的本地显示时间指示它是白天还是夜间。 |
expirationTime |
string[] |
Utc 格式的过期时间。 |
hasPrecipitation |
boolean[] |
指示是否存在降水。 |
iconCode |
integer[] |
此数字是天气图标查找的关键。 数据字段显示与所观测天气条件匹配的图标编号。 |
iconCodeExtend |
integer[] |
表示完整集合理天气的代码。 |
pressureMeanSeaLevel |
用于存储度量读数和单位的架构。 |
|
relativeHumidity |
用于存储度量读数和单位的架构。 |
|
temperature |
用于存储度量读数和单位的架构。 |
|
temperatureDewPoint |
用于存储度量读数和单位的架构。 |
|
temperatureFeelsLike |
用于存储度量读数和单位的架构。 |
|
temperatureHeatIndex |
用于存储度量读数和单位的架构。 |
|
temperatureWindChill |
用于存储度量读数和单位的架构。 |
|
uvDescription |
string[] |
UV 指数说明,通过提供因暴露 (-2 = 不可用,-1 = 无报告,0 到 2 = 低,3 到 5 = 中等,6 到 7 = 高,8 到 10 = 非常高,11 到 16 = 极端) 。 |
uvIndex |
number[] |
每小时最大 UV 指数。 |
validTime |
string[] |
时间预测以 Utc 格式有效。 |
validTimeLocal |
string[] |
时间预测在本地明显时间有效。 |
visibility |
用于存储度量读数和单位的架构。 |
|
wetBulbTemperature |
用于存储度量读数和单位的架构。 |
|
windDirection |
用于存储度量读数和单位的架构。 |
|
windGust |
用于存储度量读数和单位的架构。 |
|
windSpeed |
用于存储度量读数和单位的架构。 |
|
wxPhraseLong |
string[] |
包含较长说明的每小时合理天气短语。 |
wxPhraseShort |
string[] |
包含简短描述的每小时合理天气短语。 |
WeatherDataProviderRequest
天气数据提供程序请求的架构。
名称 | 类型 | 说明 |
---|---|---|
additionalParams |
天气数据提供程序请求的其他参数的架构。 |
|
credentials |
基于 API 密钥的身份验证的 Api 密钥身份验证凭据类。 |
|
duration |
integer |
指定返回每日预测响应的天数。 可用值为 1、5、10、25 和 45。 (仅适用于 Azure 天气地图扩展。) |
endTimeHours |
integer |
时间范围的结束时间。 (仅适用于 DTN。ClearAg extension.) |
extensionApiName |
string |
要向其发出请求的扩展 API 名称。 |
extensionId |
string |
要用于 providerInput 的扩展的 ID。 例如 DTN。ClearAg。 |
language |
string |
语言 (IETF BCP 47 语言标记) ,其中搜索结果应由数据提供程序返回。 示例:“en-US”、“es”、“es-MX”、“fr-FR”。 |
locations |
需要从提供程序中提取天气数据的位置列表。 |
|
startTimeHours |
integer |
时间范围的开始时间。 小时 0 表示当前小时。 (仅适用于 DTN。ClearAg extension.) |
units |
string |
要向其发送数据提供程序请求的单位。 支持的值为英语单位的“e”,“m”表示公制单位,“h”表示混合单位 (英国) ,“s”表示公制 SI 单位。 |
WeatherDataProviderResponse
天气数据提供程序响应的架构。
名称 | 类型 | 说明 |
---|---|---|
errors |
针对所有失败位置遇到的错误的模型。 |
|
locations |
所有天气位置的天气数据列表。 |
|
status |
指示成功、失败或部分成功响应。 |
|
weatherMetadata |
天气元数据的架构。 |
WeatherLocation
位置数据的架构。
名称 | 类型 | 说明 |
---|---|---|
type |
位置类型,例如 LatLong/IataCode/IcaoCode/Placeid/PostalKey。 |
|
value |
string |
位置值,例如 LocationType 类型“LatLong”的“10,-25”。 |
WeatherLocationData
WeatherLocationData 数据的架构。
名称 | 类型 | 说明 |
---|---|---|
data |
天气数据的架构。 |
|
lastRefreshedDateTime |
string |
上次请求资源的日期时间,示例格式:yyyy-MM-ddTHH:mm:ssZ。 |
location |
位置数据的架构。 |
|
requestCompletionTime |
string |
位置的请求完成时间(UTC)。 |
WeatherMetadata
天气元数据的架构。
名称 | 类型 | 说明 |
---|---|---|
additionalParams |
天气数据提供程序请求的其他参数的架构。 |
|
duration |
integer |
指定返回每日预测响应的天数。 可用值为 1、5、10、25 和 45。 (仅适用于 Azure 天气地图扩展。) |
endTimeHours |
integer |
时间范围的结束时间。 (仅适用于 DTN。ClearAg extension.) |
extensionApiName |
string |
要向其发出请求的扩展 API 名称。 |
extensionId |
string |
要用于 providerInput 的扩展的 ID。 例如 DTN。ClearAg。 |
extensionVersion |
string |
天气数据扩展插件的版本。 |
language |
string |
语言 (IETF BCP 47 语言标记) ,其中搜索结果应由数据提供程序返回。 示例:“en-US”、“es”、“es-MX”、“fr-FR”。 |
startTimeHours |
integer |
时间范围的开始时间。 小时 0 表示当前小时。 (仅适用于 DTN。ClearAg extension.) |
units |
string |
要向其发送数据提供程序请求的单位。 支持的值为英语单位的“e”,“m”表示公制单位,“h”表示混合单位 (英国) ,“s”表示公制 SI 单位。 |
weatherDataType |
string |
天气预报/历史) (天气数据类型。 |