MOR API

From Kolmisoft Wiki
Jump to navigationJump to search

MOR API lets other software interact to MOR without knowing internal structure of DB and other logic.

MOR accepts requests by HTML POST and returns result in XML.


Functions

Login

  • login - Logs in user into MOR
  • logout - Logs out user from MOR

Callback

Accounting

  • invoices - Retrieves list of invoices in selected time period.


HTML POST

All requests are in similar format:

HTML POST: http://<SERVER_IP>/mor/api/<function>?u=username&p=password
  • username/password - of the user who is asking for the data.

If user has 'admin' rights - he will get more results and he can perform more actions compared to the user who does not have such rights.

XML API

API by pages

All pages are requested by POST or GET methods.

Login page

a. Show Login Form
Method: GET (link: /callc/login)
Params: 0
Returns:

   
   <?xml version="1.0" encoding="UTF-8"?>
   <page>
     <pagename>Login page</pagename>
     <language>en</language>
     <error_msg></error_msg>
     <aval_languages>
       <language>en</language>
       <language>ru</language>
     </aval_languages>
   </page>
   

b. Login
Method: POST (link: /api/login?u=username&p=password)
Params: 2
Returns:
If already OK

   
   <?xml version="1.0" encoding="utf-8">
    <action>
      <name>login</name>
      <status>ok</status>
      <error_msg></error_msg> 
    </action>
   

If something wrong

   
   <?xml version="1.0" encoding="utf-8">
    <action>
      <name>login</name>
      <status>failed</status>
      <error_msg>Error description</error_msg> 
    </action>
   


Main Page

a. Show welcome page
Method: GET (link: /callc/main)
Params: 0
Returns:

 <?xml version="1.0" encoding="UTF-8"?>
 <page>
   <pagename>Main page</pagename>
   <username>Very Important User</username>
   <userid>1</userid>
   <language>en</language>
   <stats>
     <missed_calls>
     <-- in process -->  
     </missed_calls>
     <call_history>
       <calls>
         <call_counts>5</call_counts>
         <period>Month</period>
         <call_duration>00:20:35</call_duration>
       </calls>
       <calls>
         <call_counts>1</call_counts>
         <period>Day</period>
         <call_duration>00:01:35</call_duration>
       </calls>
     </call_history>
     <finances>
       <account>Postpaid</account>
       <balance>100 USD</balance>
       <credit>No Limit</credit>     
     </finances>    
   </stats>
  </page>