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

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

报告相同问题?

悬赏问题

  • ¥20 c语言写的8051单片机存储器mt29的模块程序
  • ¥60 求直线方程 使平面上n个点在直线同侧并且距离总和最小
  • ¥50 java算法,给定试题的难度数量(简单,普通,困难),和试题类型数量(单选,多选,判断),以及题库中各种类型的题有多少道,求能否随机抽题。
  • ¥50 rk3588板端推理
  • ¥250 opencv怎么去掉 数字0中间的斜杠。
  • ¥15 这种情况的伯德图和奈奎斯特曲线怎么分析?
  • ¥250 paddleocr带斜线的0很容易识别成9
  • ¥15 电子档案元素采集(tiff及PDF扫描图片)
  • ¥15 flink-sql-connector-rabbitmq使用
  • ¥15 zynq7015,PCIE读写延时偏大