如何在调用 SoftLayer_billing_Item.cancelItem(...) 后获取 softlayer_ticket id
How to get the softlayer_ticket id after calling SoftLayer_billing_Item.cancelItem(...)
我使用 SoftLayer API PHP 库调用 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 来取消项目。我注意到在 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 调用后,SoftLayer 客户门户上会生成 SoftLayer 票证。
SoftLayer_billing_Item.cancelItem(...) 或SoftLayer_billing_Item.cancelService() 的API 返回结果不包含结果SoftLayer_Ticket 信息。
如何使用 API 获取与 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 关联的 SoftLayer_Ticket Id 值。
是否有相同的 php 文件可供我使用?
您可以在代码中使用下一个 objectMask:
<?php
// Reference to the SL API client (It depends on your path installation)
require_once ('C:\softlayer-api-php-client-master\src\SoapClient.php');
require_once ('C:\softlayer-api-php-client-master\src\Common\ObjectMask.php');
// Set these values with your valid information.
$username = 'set me';
$apiKey = 'set me';
$service = 'SoftLayer_Billing_Item';
// Set your billing item Id.
$billingItemId = 7883593;
// The client instantiation.
$client = \SoftLayer\SoapClient::getClient($service, $billingItemId, $username, $apiKey);
// The next lines belong to the creation of an object mask that retrieves aditional data
// contained in the objects retrieved.
$objectMask = new \SoftLayer\Common\ObjectMask();
$objectMask->cancellationRequests->ticket;
$client->setObjectMask($objectMask);
try
{
// Retrieving the configuration options for a SoftLayer_Hardware object.
$cancellation_request = $client->getCancellationRequests();
print_r($cancellation_request);
}
catch (\Exception $e)
{
// Displaying if an error happened.
die('Script failed, review the next message for further details: ' . $e->getMessage());
}
您可以对SoftLayer_Account::getLastCanceledBillingItem或SoftLayer::getLastCancelledServerBillingItem
等方法以相同的方式使用相同的objectMask
我使用 SoftLayer API PHP 库调用 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 来取消项目。我注意到在 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 调用后,SoftLayer 客户门户上会生成 SoftLayer 票证。
SoftLayer_billing_Item.cancelItem(...) 或SoftLayer_billing_Item.cancelService() 的API 返回结果不包含结果SoftLayer_Ticket 信息。
如何使用 API 获取与 SoftLayer_billing_Item.cancelItem(...) 或 SoftLayer_billing_Item.cancelService() 关联的 SoftLayer_Ticket Id 值。
是否有相同的 php 文件可供我使用?
您可以在代码中使用下一个 objectMask:
<?php
// Reference to the SL API client (It depends on your path installation)
require_once ('C:\softlayer-api-php-client-master\src\SoapClient.php');
require_once ('C:\softlayer-api-php-client-master\src\Common\ObjectMask.php');
// Set these values with your valid information.
$username = 'set me';
$apiKey = 'set me';
$service = 'SoftLayer_Billing_Item';
// Set your billing item Id.
$billingItemId = 7883593;
// The client instantiation.
$client = \SoftLayer\SoapClient::getClient($service, $billingItemId, $username, $apiKey);
// The next lines belong to the creation of an object mask that retrieves aditional data
// contained in the objects retrieved.
$objectMask = new \SoftLayer\Common\ObjectMask();
$objectMask->cancellationRequests->ticket;
$client->setObjectMask($objectMask);
try
{
// Retrieving the configuration options for a SoftLayer_Hardware object.
$cancellation_request = $client->getCancellationRequests();
print_r($cancellation_request);
}
catch (\Exception $e)
{
// Displaying if an error happened.
die('Script failed, review the next message for further details: ' . $e->getMessage());
}
您可以对SoftLayer_Account::getLastCanceledBillingItem或SoftLayer::getLastCancelledServerBillingItem
等方法以相同的方式使用相同的objectMask