MOR API invoices get

From Kolmisoft Wiki
Revision as of 09:11, 14 February 2019 by Edvardas (talk | contribs) (→‎Returns)
Jump to navigationJump to search

Description

MOR API Retrieves a list of invoices in the selected time period.

If a user has 'admin' rights, he will get ALL invoices from the selected period. If a user has 'accountant' rights and can see only assigned users, he will get only assigned users invoices from the selected period. If user has 'user' rights, he will get only HIS invoices from the selected period.

Usage

  • From MOR X4 call: /api/invoices_get
  • For Backwards-compatibility old name 'invoices' is also usable. Call: /api/invoices
  • Methods: POST, GET(if allowed, not recomended)



Parametres

  • u - username username of user which can view invoices. Required.
  • from/till - time period for invoices in Unix Epoch Time format. Invoice's period start should be >= from and period end <= till.
  • lang - choose the language in which you want to get invoice details (mainly 'Calls').



Request

HTML POST: http://<SERVER IP>/billing/api/invoices_get?u=username&from=1188604800&till=1191196799&lang=en



Returns

Success

<Invoices from="2018-01-01" till="2019-01-01">
 <Invoice user_id="3" agreementnumber="0000000001" clientid="" number="INV1801011">
   <paid>0</paid>
   <Product>
     <Name>United States</Name>
     <Quantity>5</Quantity>
     <Price>0.0942</Price>
     <Date_added></Date_added>
     <Issue_date>2018-03-06</Issue_date>
     
   </Product>
   <Product>
     <Name>Lithuania - Fixed</Name>
     <Quantity>30</Quantity>
     <Price>13.0837</Price>
     <Date_added></Date_added>
     <Issue_date>2018-03-06</Issue_date>
     
   </Product>
   <Total_time>01:18:10</Total_time>
 </Invoice>
 <Invoice user_id="3" agreementnumber="0000000001" clientid="" number="INV1801012">
   <paid>0</paid>
   <Product>
     <Name>Lithuania - Fixed</Name>
     <Quantity>70</Quantity>
     <Price>13.7963</Price>
     <Date_added></Date_added>
     <Issue_date>2018-07-10</Issue_date>
     
   </Product>
   <Product>
     <Name>Switzerland - Fixed</Name>
     <Quantity>5</Quantity>
     <Price>0.1975</Price>
     <Date_added></Date_added>
     <Issue_date>2018-07-10</Issue_date>
     
   </Product>
   <Product>
     <Name>Singapore - Fixed</Name>
     <Quantity>4</Quantity>
     <Price>0.0987</Price>
     <Date_added></Date_added>
     <Issue_date>2018-07-10</Issue_date>
     
   </Product>
   <Product>
     <Name>Calls to DIDs</Name>
     <Quantity>79</Quantity>
     <Price>0.0000</Price>
     <Date_added></Date_added>
     <Issue_date>2018-07-10</Issue_date>
     
   </Product>
   <Total_time>02:41:16</Total_time>
 </Invoice>
 <Invoice user_id="15" agreementnumber="0000000013" clientid="" number="INV1801013">
   <paid>0</paid>
   <Total_time></Total_time>
 </Invoice>
</Invoices>




Errors

<?xml version="1.0" encoding="UTF-8"?>
<status>
  <error>Incorrect hash</error>
</status>
<Error>user not found</Error>
<Error>no invoices found</Error>



See also