Difference between revisions of "MOR API"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 42: Line 42:
Params: 0 <br />
Params: 0 <br />
Returns:  
Returns:  
    <tt>
<tt>
     <?xml version="1.0" encoding="UTF-8"?>
     <?xml version="1.0" encoding="UTF-8"?>
     <page>
     <page>
Line 53: Line 53:
       </aval_languages>
       </aval_languages>
     </page>
     </page>
    </tt>
</tt>


b. Login <br />
b. Login <br />
Line 60: Line 60:
Returns: <br />
Returns: <br />
If already OK  
If already OK  
 
<tt>
    <tt>
     <?xml version="1.0" encoding="utf-8">
     <?xml version="1.0" encoding="utf-8">
     <action>
     <action>
       <name>login</name>
       <name>login</name>
       <status>ok</status>
       <status>ok</status>
       <error_msg></error_msg>  
       <error_msg>Succesfully logged in</error_msg>  
     </action>
     </action>
    </tt>
</tt>


If something wrong <br />
If something wrong <br />
    <tt>
<tt>
     <?xml version="1.0" encoding="utf-8">
     <?xml version="1.0" encoding="utf-8">
     <action>
     <action>
Line 78: Line 77:
       <error_msg>Error description</error_msg>  
       <error_msg>Error description</error_msg>  
     </action>
     </action>
    </tt>
</tt>
 


== Main Page ==
== Main Page ==

Revision as of 17:03, 13 March 2008

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>Succesfully logged in</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>