dongteng0748 2016-06-02 13:10
浏览 66
已采纳

调用SoftLayer_billing_Item.cancelItem(...)后如何获取softlayer_ticket id

I use SoftLayer API PHP library to call SoftLayer_billing_Item.cancelItem(...) or SoftLayer_billing_Item.cancelService() to cancel the item. I noticed there will be SoftLayer ticket generated on the SoftLayer customer portal after the SoftLayer_billing_Item.cancelItem(...) or SoftLayer_billing_Item.cancelService() call.

The API returned result of SoftLayer_billing_Item.cancelItem(...) or SoftLayer_billing_Item.cancelService() doesn't contain the result SoftLayer_Ticket information.

How can I use API to get the SoftLayer_Ticket Id value associated with the SoftLayer_billing_Item.cancelItem(...) or SoftLayer_billing_Item.cancelService() .

Is there any same php file I can use ?

  • 写回答

1条回答 默认 最新

  • dougupang0901 2016-06-02 18:12
    关注

    You can use the next objectMask in your code:

    <?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());
    }
    

    You can use the same objectMask in the same way for methods such as SoftLayer_Account::getLastCanceledBillingItem or SoftLayer::getLastCancelledServerBillingItem

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题