Difference between revisions of "M4 API user login"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= MOR API Logs in user into MOR <br><br> =Usage= * For Backwards-compatibility old name 'login' is also usable. Call: '''/api/login''' * Methods: POST, GET(if a…')
 
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Description=
=Description=


[[MOR API]] Logs in user into MOR
Logs in user into the system
<br><br>
<br><br>
=Usage=
=Usage=


* For Backwards-compatibility old name 'login' is also usable. Call: '''/api/login'''
* For Backwards-compatibility old name 'login' is also usable. Call: '''/api/login'''
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET(if allowed, not recommended)
<br><br>
<br><br>
===Parameters===   
===Parameters===   


* u - username to login. '''Required'''.
* u - username to log in. '''Required'''.
* p - Password to login. '''Required'''.
* p - Password to log in. '''Required'''.
<!--- Hash check added since sprint S253 http://trac.kolmisoft.com/trac/ticket/16208#comment:2 -->
* [[M2 API hash construction | hash]] - SHA1 hash constructed using '''parameters''' above and '''API_Secret_Key'''. '''Required''' (if setting '''Disable hash checking''' is not checked).
<br><br>
<br><br>
===Request===
===Request===


  HTML POST: http://<SERVER_IP>/billing/api/user_login?u=username&p=password
  HTML POST: http://<SERVER_IP>/billing/api/user_login?u=username&p=password&hash=6e79d4a82f68102f43be11d873177f47817f84df


===Returns===
===Returns===
Line 25: Line 28:
     <name>login</name>
     <name>login</name>
     <status>ok</status>
     <status>ok</status>
     <user_id>user_id</user_id>    #this line was added on MOR11
     <user_id>user_id</user_id>     
     <status_message>Successfully logged in</status_message>
     <status_message>Successfully logged in</status_message>
   </action>
   </action>
Line 39: Line 42:
   </action>
   </action>
   
   
This means that wrong username and/or password and user can't be authenticated.
This means that the wrong username and/or password and the user can't be authenticated.
<br><br>
<br><br>


=Advanced options=
=Advanced options=
To redirect customer to MOR Billing main site go to: '''SETTINGS -> Setup -> Settings -> API''' and check the marked option:
To redirect the customer to the system's main site go to: '''SETTINGS -> Setup -> Settings -> API''' and check the marked option:
<br><br>
<br><br>
[[File:Mor_api_redirect.png]]
[[File:Mor_api_redirect.png]]
<br><br>
<br><br>
If login over API is successful the customer will be redirected to MOR Billing main site.
If login over API is successful the customer will be redirected to the system's main site.


If login is not successful :
If login is not successful :
Line 58: Line 61:
   
   


This means that wrong username and/or password and user can't be authenticated.
This means that the wrong username and/or password and the user can't be authenticated.
<br><br>
<br><br>
=See also=
=See also=


* [http://wiki.kolmisoft.com/index.php/MOR_API MOR API]
* [[M4 API]]

Latest revision as of 11:20, 28 November 2022

Description

Logs in user into the system

Usage

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



Parameters

  • u - username to log in. Required.
  • p - Password to log in. Required.
  • hash - SHA1 hash constructed using parameters above and API_Secret_Key. Required (if setting Disable hash checking is not checked).



Request

HTML POST: http://<SERVER_IP>/billing/api/user_login?u=username&p=password&hash=6e79d4a82f68102f43be11d873177f47817f84df

Returns

Success. Everything is ok. User is logged into the system you get:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>ok</status>
   <user_id>user_id</user_id>    
   <status_message>Successfully logged in</status_message>
 </action>

Error

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>failed</status>
   <status_message>Login failed</status_message>
 </action>

This means that the wrong username and/or password and the user can't be authenticated.

Advanced options

To redirect the customer to the system's main site go to: SETTINGS -> Setup -> Settings -> API and check the marked option:

Mor api redirect.png

If login over API is successful the customer will be redirected to the system's main site.

If login is not successful :

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>failed</status>
 </action>

This means that the wrong username and/or password and the user can't be authenticated.

See also