[Spce-user] Create invoice via API: No response via http GET
Thomas Georg
t.georg at msg-gruppe.de
Fri Jan 25 08:36:23 EST 2019
Hi list,
I am currently trying to get the invoicing running on SPCE 6.4.1. Therefore I wrote the following PHP-Script:
______________________________________________________________________________________________________________________________
// Some options
$auth_username = 'administrator';
$auth_password = SomePassword';
$url = 'https://siplab:1443/api/invoices/';
$header = array('Content-Type: application/json');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => $header,
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'API-Test',
CURLOPT_HTTPAUTH=> CURLAUTH_BASIC,
CURLOPT_USERPWD => "$auth_username:$auth_password",
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => json_encode(array(
'customer_id' => 8,
'template_id' => 2,
'period' => '2018-12'
))
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
echo "response: ".$resp;
echo curl_error($curl);
var_dump($resp);
// Close request to clear up some resources
curl_close($curl);
______________________________________________________________________________________________________________________________
The invoice is created but I do not get any response from the SPCE.
This is what api.log says:
Jan 25 11:55:09 spce ngcp-panel: INFO: IP=my.client CALLED=API[POST]/api/invoices/ TX=157D1210673F6BE8 USER=administrator DATA={} MSG="" LOG="{"customer_id":8,"template_id":2,"period":"2018-09"}"
Jan 25 11:55:09 spce ngcp-panel: INFO: IP=my.client CALLED=API[POST 201]/api/invoices/ TX=157D1210673F6BE8 USER=administrator DATA={} MSG="" LOG=""
I need the response as shown in the API-Documentation to use it in other scripts.
Any ideas? What am I missing?
Regards
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/mailman/private/spce-user_lists.sipwise.com/attachments/20190125/e29761ce/attachment.html>
More information about the Spce-user
mailing list