Difference between revisions of "MOR API credit notes get"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 1: Line 1:
=Description=
<!---This functionality is available from MOR 12--->
<!---This functionality is available from MOR 12--->
[[MOR API]] Credit notes list
[[MOR API]] Credit notes list
<br><br>
<br><br>
----
=Usage=
 
* Call: /api/credit_notes_get
* For Backwards-compatibility old name 'credit_notes' is also usable. Call: /api/credit_notes
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parametres===
 
* user_id - User ID in MOR database, whose credit notes we want to see. '''Optional'''.
* credit_note_id - Credit note ID in MOR database which we want to see. if supplied, credit_note_id has precedence over user_id '''Optional'''.
* 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
 
We send:
 
HTML POST: http://<SERVER_IP>/billing/api/credit_notes?u=username&credit_note_id=345&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
 
 
'''* Note that username are not included in hash'''
<br><br>
<br><br>
* Call: /api/credit_notes
===Returns===
* Methods: POST, GET(if allowed, not recomended)
 
* Params:
'''Success'''
** user_id - User ID in MOR database, whose credit notes we want to see. '''Optional'''.
** credit_note_id - Credit note ID in MOR database which we want to see. if supplied, credit_note_id has precedence over user_id '''Optional'''.
** 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:
<?xml version="1.0" encoding="UTF-8"?>
**Success
<page>
*** <credit_notes>  
  <credit_notes>  
***  <credit_note>  
  <credit_note>  
***    <user_id><user_id>
      <user_id><user_id>
***    <issue_date></issue_date>
      <issue_date></issue_date>
***    <number></number>
      <number></number>
***    <comment></comment>
      <comment></comment>
***    <price></price>
      <price></price>
***    <price_with_vat></price_with_vat>
    <price_with_vat></price_with_vat>
***    <pay_date></pay_date>
    <pay_date></pay_date>
***  </credit_note>
  </credit_note>
*** ...  
  <credit_note>
*** </credit_notes>
  ...  
  </credit_note>
  </credit_notes>
</page>


Note that if user of type accountant does not have privileges to manage invoices at least in read mode he cannot see any credit notes. if he does have this priviledge, but does note have privilege to see financial data, accountant will see only user_id, price, issue_date, number and comment.
Note that if user of type accountant does not have privileges to manage invoices at least in read mode he cannot see any credit notes. if he does have this priviledge, but does note have privilege to see financial data, accountant will see only user_id, price, issue_date, number and comment.
----
** Errors:
'''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.
* <error>Bad login</error> - User supplied bad login.
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
<br><br>
<br><br>
----
=See also=
*Example:
 
**We have user_id = 123, that has credit note(id=345) API Secret Key = 456789
* [[MOR API]]
**Hash string to be converted: "123456789"
**We might send:
***/api/credit_notes?u=user&p=user1&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
***/api/credit_notes?u=user&p=user1&credit_note_id=345&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
***/api/credit_notes?u=user&p=user1&user_id=123&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
***/api/credit_notes?u=user&p=user1&user_id=123&credit_note_id=345&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441
'''* Note that username and password are not included in hash'''

Revision as of 04:08, 27 May 2013

Description

MOR API Credit notes list

Usage

  • Call: /api/credit_notes_get
  • For Backwards-compatibility old name 'credit_notes' is also usable. Call: /api/credit_notes
  • Methods: POST, GET(if allowed, not recomended)



Parametres

  • user_id - User ID in MOR database, whose credit notes we want to see. Optional.
  • credit_note_id - Credit note ID in MOR database which we want to see. if supplied, credit_note_id has precedence over user_id Optional.
  • 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/credit_notes?u=username&credit_note_id=345&hash=f7c3bc1d808e04732adf679965ccc34ca7ae3441


* Note that username are not included in hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <credit_notes> 
  <credit_note> 
     <user_id><user_id>
     <issue_date></issue_date>
     <number></number>
     <comment></comment>
     <price></price>
    <price_with_vat></price_with_vat>
    <pay_date></pay_date>
  </credit_note>
  <credit_note> 
  ... 
  </credit_note>
 </credit_notes>
</page>

Note that if user of type accountant does not have privileges to manage invoices at least in read mode he cannot see any credit notes. if he does have this priviledge, but does note have privilege to see financial data, accountant will see only user_id, price, issue_date, number and comment.


Errors

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



See also