python - 如何使用 Python API 从 sotlayer 保存的报价中检索对象
问题描述
我正在尝试检索存储在特定 Softlayer 帐户的已保存报价下的对象/项目(服务器名称、主机名、域名、位置等)。有人可以帮助如何检索报价中的对象吗?我可以找到一个 REST API (Python) 来检索报价详细信息(报价 ID、状态等),但找不到在报价中获取对象的方法。
谢谢!
此致,
凯兰帕特尔
解决方案
如果您尝试检索您在放置报价时发送的相同订单信息结构,那么您需要使用方法getRecalculatedOrderContainer,它应该返回 packageId、presetId、位置、项目价格等,但据我所知,主机名、域、sshKeys、provisionScripts、vlan 不在报价中,因为无论用户在下订单之前是否需要新值,或者由于 vlan 和子网等资源的可用性而避免系统错误,这些值可能会随着时间的推移而改变。
https://[username]:[apikey]api.softlayer.com/rest/v3/SoftLayer_Billing_Order_Quote/[quoteID]/getRecalculatedOrderContainer
Method: GET
现在,如果您想检索 orderId、item 等,那么无论您是使用这些方法还是它们都在列表中或作为单个对象返回数据类型SoftLayer_Billing_Order_Quote ,都需要使用对象掩码功能。Account::getQuotes
SoftLayer_Billing_Order_Quote::getObject
帐户::getQuotes
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getQuotes?objectMask=mask[id,name,order[id,status,items[id,description,domainName,hostName,location]]]
Method: GET
SoftLayer_Billing_Order_Quote::getObject
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Billing_Order_Quote/[quoteID]/getObject?objectMask=mask[id,name,order[id,status,items[id,description,location]]]
Method: GET
参考:
https://softlayer.github.io/reference/services/SoftLayer_Account/getQuotes/
https://softlayer.github.io/reference/services/SoftLayer_Billing_Order_Quote/
https://softlayer.github.io/reference/datatypes/SoftLayer_Billing_Order_Quote/
推荐阅读
- pandas - 调用 pandas to_sql() 时抑制 SQL 语句的输出
- php - 如何在 MongoDB/PHP 中以最佳方式进行分组
- javascript - 从日期字符串以 UTC 正确计算日期时间
- unix - 从命令提示符执行相同的命令可以正常工作
- python - Defore 过采样数据显示 0
- python - 张量流中的花式索引
- javascript - 如何使用 require.js?
- django - Django - prefetch_related 的使用
- amazon-web-services - IOT 设备如何在设备预置期间使用预置声明证书与 AWS IOT 连接?
- express - 尝试使用邮递员更新我的 Express 数据库