Difference between revisions of "MOR API invoices get"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(8 intermediate revisions by 3 users not shown)
Line 2: Line 2:
[[MOR API]] Retrieves a list of invoices in the selected time period.
[[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 user has 'user' rights, he will get only '''HIS''' invoices from the selected 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.
<br><br>
<br><br>
=Usage=
=Usage=


Line 12: Line 13:
===Parametres===
===Parametres===


* u - username username of user which can view invoices. '''Required'''.
* u - username username of user which can view invoices.
* from/till - time period for invoices in [http://en.wikipedia.org/wiki/Unix_time Unix Epoch Time] format. Invoice's '''period start''' should be >= '''from''' and '''period end''' <= '''till'''.
* from/till - time period for invoices in [http://en.wikipedia.org/wiki/Unix_time Unix Epoch Time] format. Invoice's '''period start''' should be >= '''from''' and '''period end''' <= '''till'''.
** http://www.epochconverter.com/ can help to convert time for testing.
** http://www.epochconverter.com/ can help to convert time for testing.
* lang - choose the language in which you want to get invoice details (mainly 'Calls').
* lang - choose the language in which you want to get invoice details (mainly 'Calls').
<br><br>
<br><br>
===Request===
===Request===


Line 24: Line 26:


'''Success'''
'''Success'''
 
  <Invoices from="2019-05-01" till="2019-05-31">
  <Invoices till="2015-08-22" from="2005-04-21">
<Invoice user_id="2" agreementnumber="" clientid="" number="INV1905011">
  <Invoice clientid="" number="INV0706221" agreementnumber="" user_id="0">
<id>5</id>
    <Product>
<paid>0</paid>
      <Name>Calls</Name>
<Product>
      <Quantity>2</Quantity>
<Name>Test_periodic_service - 1</Name>
      <Price>5.0000</Price>
<Quantity>1</Quantity>
      <Date_added></Date_added>
<Price>10.0000</Price>
      <Issue_date>2012-06-22</Issue_date>
<Discount>0.0000</Discount>
    </Product>
<Sum>10.0000</Sum>
  </Invoice>
<Date_added/>
  <Invoice clientid="" number="INV0706222" agreementnumber="" user_id="2">
<Issue_date>2019-06-27</Issue_date>
    <Product>
<Time/>
      <Name>Calls</Name>
<Service_id>1</Service_id>
      <Quantity>4</Quantity>
<Prefix></Prefix>
      <Price>20.0000</Price>
</Product>
      <Date_added></Date_added>
<Product>
      <Issue_date>2012-06-22</Issue_date>
<Name>Test_periodic_service - 2</Name>
    </Product>
<Quantity>1</Quantity>
    <Product>
<Price>10.0000</Price>
      <Name>Test_periodic_service - Test_preriodic_service_memo</Name>
<Discount>2.0000</Discount>
      <Quantity>1</Quantity>
<Sum>8.0000</Sum>
      <Price>390.5591</Price>
<Date_added/>
      <Date_added></Date_added>
<Issue_date>2019-06-27</Issue_date>
      <Issue_date>2012-06-22</Issue_date>
<Time/>
    </Product>
<Service_id>2</Service_id>
  </Invoice>
<Prefix></Prefix>
  <Invoice clientid="" number="INV0706223" agreementnumber="0000000001" user_id="3">
</Product>
    <Product>
<Total_time/>
      <Name>Calls</Name>
</Invoice>
      <Quantity>2</Quantity>
      <Price>11.0000</Price>
      <Date_added></Date_added>
      <Issue_date>2012-06-22</Issue_date>
    </Product>
    <Product>
      <Name>Calls from Users</Name>
      <Quantity>7</Quantity>
      <Price>52.0000</Price>
      <Date_added></Date_added>
      <Issue_date>2012-06-22</Issue_date>
    </Product>
  </Invoice>
  </Invoices>
  </Invoices>
<br><br>
----
----



Latest revision as of 12:24, 4 December 2024

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.
  • 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="2019-05-01" till="2019-05-31">
<Invoice user_id="2" agreementnumber="" clientid="" number="INV1905011">
<id>5</id>
<paid>0</paid>
<Product>
<Name>Test_periodic_service - 1</Name>
<Quantity>1</Quantity>
<Price>10.0000</Price>
<Discount>0.0000</Discount>
<Sum>10.0000</Sum>
<Date_added/>
<Issue_date>2019-06-27</Issue_date>

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