Softlayer API 提取所有发票

Softlayer API to pull all invoices

我使用 PHP 通过

从 SoftLayer 的 API 中成功拉取了 excel sheet
$client = \SoftLayer\SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$invoice = $client->getNextInvoiceExcel();

我将它写入网络服务器上的某个位置并使用 crontab 执行。

我想知道我是否也可以提取前几个月的 Excel sheet。通过 Softlayer 门户网站,我可以通过手动选择发票并将其下载到 Excel 来提取此信息。问题是我们管理着多个帐户,我们希望使用 id 和 api 键自动提取他们上个月的发票。

现在我只能使用以下方式列出它们:

$client = \SoftLayer\SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$user_bill = $client->getOpenRecurringInvoices();

print_r($user_bill);

感谢您的帮助。

使用 SLAPI 方法,它可能会帮助您: SoftLayer_Billing_Invoice/getExcel.

首先,您可以获得发票:SoftLayer_Account::getOpenRecurringInvoices

然后,在最后一个请求中显示invoice_ids,你可以执行(Rest example):

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Billing_Invoice/[invoice_id]/getExcel

Method: GET

希望对你有所帮助