SoftLayer 帐户未考虑 Object 掩码
SoftLayer Account not considering the Object Mask
问题:我正在尝试点击 API 并为 SoftLayer_Account#getVirtualGuests 使用 Object 掩码,但它似乎被忽略了。
我尝试过的:
用 header
调用 SoftLayer_Virtual_Guest.getObject
<SoftLayer_Virtual_GuestObjectMask>
<mask>
<datacenter xsi:nil="true" />
<bandwidthAllotmentDetail><allocation xsi:nil="true" /></bandwidthAllotmentDetail>
</mask>
</SoftLayer_Virtual_GuestObjectMask>
完美运行,但是当我用 header
调用 SoftLayer_Account.getVirtualGuests 时
<SoftLayer_AccountObjectMask>
<mask>
<datacenter xsi:nil="true" />
<bandwidthAllotmentDetail><allocation xsi:nil="true" /></bandwidthAllotmentDetail>
</mask>
</SoftLayer_AccountObjectMask>
它不起作用,正如我在 https://sldn.softlayer.com/article/object-masks 文章中看到的那样,当调用 SoftLayer_Account::getHardware 时,您需要为特定类型设置根 属性,但是根据这个例子我不知道如何使用 SOAP 调用。
如果可以提供有关如何使用 Object Mask 和 Object Filter 的示例 SoftLayer_Account.getVirtualGuests
我这边可以应付。
谢谢
我没有发现通过 getVirtualGuests 调用使用对象掩码的问题
curl -s -g --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" "https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests.json?objectMask=mask[domain,bandwidthAllotmentDetail]" | python -m json.tool
[
{
"bandwidthAllotmentDetail": {
"allocationId": 5318597,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-02-12T11:45:38-06:00",
"endEffectiveDate": null,
"id": 5479443,
"serviceProviderId": 1
},
"domain": "tinylab.info"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5569801,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-22T10:17:46-06:00",
"endEffectiveDate": null,
"id": 5736289,
"serviceProviderId": 1
},
"domain": "tinylayer.net"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5468679,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-04T00:00:00-06:00",
"endEffectiveDate": null,
"id": 5633115,
"serviceProviderId": 1
},
"domain": "tinylab.info"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5600063,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-28T08:32:41-06:00",
"endEffectiveDate": null,
"id": 5767743,
"serviceProviderId": 1
},
"domain": "tinylab.info"
}
]
这将返回 json 我帐户中所有虚拟访客的列表,以及 API 响应的 bandwidthAllotmentDetail 部分。
请使用 SOAP 请求尝试以下示例:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/">
<soapenv:Header>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
<v3:SoftLayer_ObjectMask xsi:type="v3:SoftLayer_ObjectMask">
<mask xsi:type="xsd:string">mask[id,datacenter,bandwidthAllotmentDetail]</mask>
</v3:SoftLayer_ObjectMask>
<SoftLayer_AccountObjectFilter xsi:type="v3:SoftLayer_AccountObjectFilter"/>
<SoftLayer_AccountObjectMask xsi:type="v3:SoftLayer_AccountObjectMask">
<mask xsi:type="v3:SoftLayer_Account"/>
</SoftLayer_AccountObjectMask>
</soapenv:Header>
<soapenv:Body>
<v3:getVirtualGuests soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>
如果你想合并object Masks
和object Filters
,请看:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/">
<soapenv:Header>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
<v3:SoftLayer_ObjectMask xsi:type="v3:SoftLayer_ObjectMask">
<mask xsi:type="xsd:string">filteredMask[id,datacenter,bandwidthAllotmentDetail]</mask>
</v3:SoftLayer_ObjectMask>
<v3:SoftLayer_AccountObjectFilter xsi:type="v3:SoftLayer_AccountObjectFilter">
<virtualGuests>
<datacenter>
<name>
<operation>dal06</operation>
</name>
</datacenter>
</virtualGuests>
</v3:SoftLayer_AccountObjectFilter>
<SoftLayer_AccountObjectMask xsi:type="v3:SoftLayer_AccountObjectMask">
<mask xsi:type="v3:SoftLayer_Account"/>
</SoftLayer_AccountObjectMask>
</soapenv:Header>
<soapenv:Body>
<v3:getVirtualGuests soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>
问题:我正在尝试点击 API 并为 SoftLayer_Account#getVirtualGuests 使用 Object 掩码,但它似乎被忽略了。
我尝试过的:
用 header
调用 SoftLayer_Virtual_Guest.getObject<SoftLayer_Virtual_GuestObjectMask>
<mask>
<datacenter xsi:nil="true" />
<bandwidthAllotmentDetail><allocation xsi:nil="true" /></bandwidthAllotmentDetail>
</mask>
</SoftLayer_Virtual_GuestObjectMask>
完美运行,但是当我用 header
调用 SoftLayer_Account.getVirtualGuests 时<SoftLayer_AccountObjectMask>
<mask>
<datacenter xsi:nil="true" />
<bandwidthAllotmentDetail><allocation xsi:nil="true" /></bandwidthAllotmentDetail>
</mask>
</SoftLayer_AccountObjectMask>
它不起作用,正如我在 https://sldn.softlayer.com/article/object-masks 文章中看到的那样,当调用 SoftLayer_Account::getHardware 时,您需要为特定类型设置根 属性,但是根据这个例子我不知道如何使用 SOAP 调用。
如果可以提供有关如何使用 Object Mask 和 Object Filter 的示例 SoftLayer_Account.getVirtualGuests
我这边可以应付。
谢谢
我没有发现通过 getVirtualGuests 调用使用对象掩码的问题
curl -s -g --user "$SOFTLAYER_USERNAME:$SOFTLAYER_API_KEY" "https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests.json?objectMask=mask[domain,bandwidthAllotmentDetail]" | python -m json.tool
[
{
"bandwidthAllotmentDetail": {
"allocationId": 5318597,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-02-12T11:45:38-06:00",
"endEffectiveDate": null,
"id": 5479443,
"serviceProviderId": 1
},
"domain": "tinylab.info"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5569801,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-22T10:17:46-06:00",
"endEffectiveDate": null,
"id": 5736289,
"serviceProviderId": 1
},
"domain": "tinylayer.net"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5468679,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-04T00:00:00-06:00",
"endEffectiveDate": null,
"id": 5633115,
"serviceProviderId": 1
},
"domain": "tinylab.info"
},
{
"bandwidthAllotmentDetail": {
"allocationId": 5600063,
"bandwidthAllotmentId": 138442,
"effectiveDate": "2016-03-28T08:32:41-06:00",
"endEffectiveDate": null,
"id": 5767743,
"serviceProviderId": 1
},
"domain": "tinylab.info"
}
]
这将返回 json 我帐户中所有虚拟访客的列表,以及 API 响应的 bandwidthAllotmentDetail 部分。
请使用 SOAP 请求尝试以下示例:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/">
<soapenv:Header>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
<v3:SoftLayer_ObjectMask xsi:type="v3:SoftLayer_ObjectMask">
<mask xsi:type="xsd:string">mask[id,datacenter,bandwidthAllotmentDetail]</mask>
</v3:SoftLayer_ObjectMask>
<SoftLayer_AccountObjectFilter xsi:type="v3:SoftLayer_AccountObjectFilter"/>
<SoftLayer_AccountObjectMask xsi:type="v3:SoftLayer_AccountObjectMask">
<mask xsi:type="v3:SoftLayer_Account"/>
</SoftLayer_AccountObjectMask>
</soapenv:Header>
<soapenv:Body>
<v3:getVirtualGuests soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>
如果你想合并object Masks
和object Filters
,请看:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/">
<soapenv:Header>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
<v3:SoftLayer_ObjectMask xsi:type="v3:SoftLayer_ObjectMask">
<mask xsi:type="xsd:string">filteredMask[id,datacenter,bandwidthAllotmentDetail]</mask>
</v3:SoftLayer_ObjectMask>
<v3:SoftLayer_AccountObjectFilter xsi:type="v3:SoftLayer_AccountObjectFilter">
<virtualGuests>
<datacenter>
<name>
<operation>dal06</operation>
</name>
</datacenter>
</virtualGuests>
</v3:SoftLayer_AccountObjectFilter>
<SoftLayer_AccountObjectMask xsi:type="v3:SoftLayer_AccountObjectMask">
<mask xsi:type="v3:SoftLayer_Account"/>
</SoftLayer_AccountObjectMask>
</soapenv:Header>
<soapenv:Body>
<v3:getVirtualGuests soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</soapenv:Body>
</soapenv:Envelope>