Azure定价API无法正确过滤

发布于 2025-02-08 08:02:09 字数 1288 浏览 1 评论 0原文

我无法过滤从Azure CLI返回的价格:

az rest -u https://prices.azure.com/api/retail/prices --url-parameters '{"skuName":"F4s v2"}'

产生一个清晰未过滤的结果,

    {
      "armRegionName": "westcentralus",
      "armSkuName": "Standard_E4ds_v5",
      "currencyCode": "USD",
      "effectiveStartDate": "2021-11-01T00:00:00Z",
      "isPrimaryMeterRegion": true,
      "location": "US West Central",
      "meterId": "00172462-4604-5a25-b1d4-f057577d68e0",
      "meterName": "E4ds v5 Low Priority",
      "productId": "DZH318Z096SL",
      "productName": "Virtual Machines Edsv5 Series Windows",
      "retailPrice": 0.212,
      "serviceFamily": "Compute",
      "serviceId": "DZH313Z7MMC8",
      "serviceName": "Virtual Machines",
      "skuId": "DZH318Z096SL/0424",
      "skuName": "E4ds v5 Low Priority",
      "tierMinimumUnits": 0.0,
      "type": "Consumption",
      "unitOfMeasure": "1 Hour",
      "unitPrice": 0.212
    }
  ],
  "NextPageLink": "https://prices.azure.com:443/api/retail/prices?skuName=F4s%20v2&$skip=100"
}

但如果我转到:

https://prices.azure.com/api/retail/retail/retail/prices?currencycode=gbpppp& $ filter = skuname%20EQ%20%27F4S%20v2%27

它可以提起定价信息,这没问题。

谁能解释我在做什么错误?

谢谢

I am unable to filter the prices returned from the azure cli:

az rest -u https://prices.azure.com/api/retail/prices --url-parameters '{"skuName":"F4s v2"}'

produces a clearly unfiltered result ending with:

    {
      "armRegionName": "westcentralus",
      "armSkuName": "Standard_E4ds_v5",
      "currencyCode": "USD",
      "effectiveStartDate": "2021-11-01T00:00:00Z",
      "isPrimaryMeterRegion": true,
      "location": "US West Central",
      "meterId": "00172462-4604-5a25-b1d4-f057577d68e0",
      "meterName": "E4ds v5 Low Priority",
      "productId": "DZH318Z096SL",
      "productName": "Virtual Machines Edsv5 Series Windows",
      "retailPrice": 0.212,
      "serviceFamily": "Compute",
      "serviceId": "DZH313Z7MMC8",
      "serviceName": "Virtual Machines",
      "skuId": "DZH318Z096SL/0424",
      "skuName": "E4ds v5 Low Priority",
      "tierMinimumUnits": 0.0,
      "type": "Consumption",
      "unitOfMeasure": "1 Hour",
      "unitPrice": 0.212
    }
  ],
  "NextPageLink": "https://prices.azure.com:443/api/retail/prices?skuName=F4s%20v2&$skip=100"
}

Although if i go to:

https://prices.azure.com/api/retail/prices?currencyCode=GBP&$filter=skuName%20eq%20%27F4s%20v2%27

it pulls up the pricing info filtered no problem.

Can anyone explain what I am doing incorrectly?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱情眠于流年 2025-02-15 08:02:09

您可能遵循的解决方案之一是为了达到上述要求,

看来,标题有一个问题,因为您提供了参数,因为skuname,因此未正确列出了价格尝试使用$ filter

您可以使用以下api格式。

https://prices.azure.com/api/retail/prices?currencyCode='EUR'&$filter=serviceFamily eq 'Compute'

您会得到以下类似的东西;

有关完整信息,请参阅以下链接:

One of the workaround you may follow to achieve the above requirement ,

It seems there is an issue with the header as you have provide the parameter as the skuname so the pricings are not listed properly instead of that try to use $filter.

You may use the below api format for example ;

https://prices.azure.com/api/retail/prices?currencyCode='EUR'&$filter=serviceFamily eq 'Compute'

You will get something like below;

enter image description here

For complete information please refer the below links:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文