Difference between revisions of "MOR API"
Line 65: | Line 65: | ||
<name>login</name> | <name>login</name> | ||
<status>ok</status> | <status>ok</status> | ||
< | <status_message>Succesfully logged in</status_message> | ||
</action> | </action> | ||
</tt> | </tt> | ||
Line 75: | Line 75: | ||
<name>login</name> | <name>login</name> | ||
<status>failed</status> | <status>failed</status> | ||
< | <status_message>Error description</status_message> | ||
</action> | </action> | ||
</tt> | </tt> |
Revision as of 17:15, 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
Callback
- callback - Initiates 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> <status_message>Succesfully logged in</status_message> </action>
If something wrong
<?xml version="1.0" encoding="utf-8"> <action> <name>login</name> <status>failed</status> <status_message>Error description</status_message> </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>
Details
a. Show personal details
Method: GET (link: /users/personal_details)
Params: 0
Returns:
<?xml version="1.0" encoding="UTF-8"?> <page> <pagename>Personal details</pagename> <language>en</language> <userid>1</userid> <details> <main_details> <alias>101</alias> <account>Postpaid</account> <balance>100 USD</balance> <credit>No Limit</credit> </main_details> <other_details> <username>Andrey</username> <surname>Mazunin</surname> <personalid></personalid> <agreement_number></agreement_number> <agreement_date>2008-03-11</agreement_date> <taxation_country>Uzbekistan</taxation_country> <vat_reg_number></vat_reg_number> <vat_percent>18.0</vat_percent> </other_details> <registration> <reg_address>Address</reg_address> <reg_postcode>700100</reg_postcode> <reg_city>Tashkent</reg_city> <reg_country>Uzbekistan</reg_country> <reg_state></reg_state> <reg_direction>Uzbekistan</reg_direction> <reg_phone>998975551234</reg_phone> <reg_mobile>998975551234</reg_mobile> <reg_fax>998975551234</reg_fax> <reg_email>admin@voip.com</reg_email> </registration> </details> </page>
b. Edit personal details
Desc: User edit personal details and push "Change" button
Method: POST (link: /users/update_personal_details/%userid%)
Params: 17
Returns:
If already OK
<?xml version="1.0" encoding="UTF-8"?> <action> <name>edit_personal</name> <status>ok</status> <status_message>Personal details changed</status_message> </action>
If something wrong
<?xml version="1.0" encoding="UTF-8"?> <action> <name>edit_personal</name> <status>failed</status> <status_message>Error description</status_message> </action>