用于提取所有发票的软层 API


Softlayer API to pull all invoices

我成功地使用 PHP 从 SoftLayer 的 API 中提取了一个 excel 工作表

,通过
$client = 'SoftLayer'SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$invoice = $client->getNextInvoiceExcel();

我把它写到一个位置,它进入网络服务器并使用 crontab 执行。

正在尝试找出我是否也可以提取前几个月的 Excel 工作表。通过 Softlayer Web 门户,我能够通过手动选择发票并将其下载到 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 示例):

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

我希望它对你有所帮助。