Difference between revisions of "MOR API financial statements get"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with ''This functionality is available from MOR 12'' MOR API Financial statements list <br><br> ---- <br><br> * Call: /api/financial_statements * Methods: POST, GE…')
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'This functionality is available from [[MOR 12| MOR 12]]''
=Description=
<!---This functionality is available from MOR 12--->
[[MOR API]] Financial statements list
<br><br>
=Usage=
 
* From '''MOR X4''' call: '''/api/financial_statements_get'''
* For Backwards-compatibility old name 'financial_statements' is also usable. Call: '''/api/financial_statements'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parametres===
 
* user_id - User ID in MOR database, whose financial statement we want to see. '''Optional'''.
* stauts - Credit note status. Valid values are 'paid', 'unpaid', 'all' if not supplied defaults to 'all'. '''Optional'''.
* date_till - When filtering financial statements by date, this would be minimal date when invoice/credit note/payment was issued. '''Required'''
* date_from - When filtering financial statements by date, this would be maximal date when invoice/credit note/payment was issued. '''Required'''
* u - username for authentication. '''Required'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
<br><br>
===Request===


We have user_id = 123, that has credit note(id=345) API Secret Key = 456789


[[MOR API]]
We send:


Financial statements list
HTML POST: http://<SERVER_IP>/billing/api/financial_statements?u=user&p=user1&date_till=234523&date_from=22354&user_id=123&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441


'''NOTE that username are not included in hash'''
<br><br>
<br><br>
----
<br><br>


* Call: /api/financial_statements
===Returns===
* Methods: POST, GET(if allowed, not recomended)
 
* Params:
'''Success'''
** user_id - User ID in MOR database, whose financial statement we want to see. '''Optional'''.
** stauts - Credit note status. Valid values are 'paid', 'unpaid', 'all' if not supplied defaults to 'all'. '''Optional'''.
** date_till - When filtering financial statements by date, this would be minimal date when invoice/credit note/payment was issued. '''Required''
** date_from - When filtering financial statements by date, this would be maximal date when invoice/credit note/payment was issued. '''Required''
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
**


* Returns:
<page>
**Success
  <financial_statement currency='USD'>  
*** <financial_statement currency='USD'>  
  <statement type='type'>  
***  <statement type='invoices'>  
    <status></status>
***    <status></status>
    <count></count>
***    <count></count>
    <price></price>
***    <price></price>
    <price_with_vat></price_with_vat>
***    <price_with_vat></price_with_vat>
    <price></price>
***    <price></price>
  </statement>
***  </statement>
  <statement type='type'>
*** ...  
  ...  
*** </financial_statement>
  </statement>
  </financial_statement>
</page>


Note that 'currency' is system default currency code.
Note that 'currency' is system default currency code.
Note that 'type' can be 'invoices', 'credit_notes' or 'payments'. Status might be 'paid' or 'unpaid'.
Note that 'type' can be 'invoices', 'credit_notes' or 'payments'. Status might be 'paid' or 'unpaid'.
Note that if user of type accountant does not have privileges to manage invoices, financial data, payments at least in read mode he cannot see any financial statements
Note that if user of type accountant does not have privileges to manage invoices, financial data, payments at least in read mode he cannot see any financial statements
** Errors:
*** <error>Bad login</error> - User supplied bad login or password.
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
<br><br>
<br><br>
----
----
*Example:
 
**We have user_id = 123, that has credit note(id=345) API Secret Key = 456789
'''Errors'''
**Hash string to be converted: "123456789"
 
**We might send:
* <error>Bad login</error> - User supplied bad login or password.
***/api/financial_statements?u=user&p=user1&date_till=234523&date_from=22354&user_id=123&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
***/api/credit_notes?u=user&p=user1&status=paid&date_till=234523&date_from=22354&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
<br><br>
'''* Note that username and password are not included in hash'''
 
=See also=
 
* [[MOR API]]

Latest revision as of 06:59, 8 October 2013

Description

MOR API Financial statements list

Usage

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



Parametres

  • user_id - User ID in MOR database, whose financial statement we want to see. Optional.
  • stauts - Credit note status. Valid values are 'paid', 'unpaid', 'all' if not supplied defaults to 'all'. Optional.
  • date_till - When filtering financial statements by date, this would be minimal date when invoice/credit note/payment was issued. Required
  • date_from - When filtering financial statements by date, this would be maximal date when invoice/credit note/payment was issued. Required
  • u - username for authentication. Required.
  • hash - SHA1 hash constructed using user_id and API_Secret_Key ( More described in Constructing hash). Required.



Request

We have user_id = 123, that has credit note(id=345) API Secret Key = 456789

We send:

HTML POST: http://<SERVER_IP>/billing/api/financial_statements?u=user&p=user1&date_till=234523&date_from=22354&user_id=123&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441

NOTE that username are not included in hash

Returns

Success

<page>
 <financial_statement currency='USD'> 
  <statement type='type'> 
    <status></status>
    <count></count>
    <price></price>
    <price_with_vat></price_with_vat>
    <price></price>
  </statement>
  <statement type='type'> 
  ... 
  </statement>
 </financial_statement>
</page>

Note that 'currency' is system default currency code. Note that 'type' can be 'invoices', 'credit_notes' or 'payments'. Status might be 'paid' or 'unpaid'. Note that if user of type accountant does not have privileges to manage invoices, financial data, payments at least in read mode he cannot see any financial statements


Errors

  • <error>Bad login</error> - User supplied bad login or password.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.



See also