Difference between revisions of "MOR API email send"

From Kolmisoft Wiki
Jump to navigationJump to search
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[MOR API]]
=Description=
[[MOR API]] Send Email
<br><br>
=Usage=


Send Email
* From '''MOR X4''' call: '''/api/email_send'''
* For Backwards-compatibility old name 'send_email' is also usable. Call: '''/api/send_email'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parametres===


* email_name - Email template name. '''Required'''.
* u - username for authentication. '''Required'''.
* email_to_user_id - User ID which will receive email. If parameter is not supplied email is sent to user authorized with parameters u and p.
* email template params. http://wiki.kolmisoft.com/index.php/Email_variables
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
'''NOTE'''. If in [[Emails| email template]] there are used some parameters and you do not send them over API, client will get email with empty spaces instead of those parameters. Before sending email over API, be sure that you send all parameters used in email template.
<br><br>
<br><br>
----
 
===Request===
 
We have email_name = registration_confirmation_for_user, email_to_user_id = 142, login_username = new_first_name, login_url = www.kolmisoft.com, server_ip = 127.0.0.2, API key = 123456
 
We send:
 
HTML POST: http://<SERVER_IP>/billing/api/email_send?u=username&email_name=registration_confirmation_for_user&email_to_user_id=142&login_username=new_first_name&login_url=www.kolmisoft.com&server_ip=127.0.0.2&hash=565582398d663e87b5fe3a523f8937fb693bf1e1
 
 
'''NOTE that username are not included in hash'''
 
We recive in email:
 
Your device settings: Server IP: 127.0.0.2 Device type: Username: Password: ---- Settings to login to MOR interface: Login URL: www.kolmisoft.com Username: new_first_name Password: Thank you for registering!
<br><br>
<br><br>


* Call: /api/send_email
===Returns===
* Params:
** email_name - Email template name. '''Required'''.
** u - username to login. '''Required'''.
** p - password to login. '''Required'''.
** email_to_user_id - User ID which will receive email. If parameter is not supplied email is sent to user authorized with parameters u and p.
** email template params. http://wiki.kolmisoft.com/index.php/Email_variables
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.


'''Success'''


* Returns:
<?xml version="1.0" encoding="UTF-8"?>
**Success
<page>
<email_sending_status>Email sent</email_sending_status>
  <email_sending_status>Email sent</email_sending_status>
</page>
<br><br>
----
'''Errors'''


** Errors:
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* <error>Bad login</error>
*** <error>Bad login</error>
* <error>Email not found</error> - Email not found by supplied name in param email_name under logged user account.
*** <error>Email not found</error> - Email not found by supplied name in param email_name under logged user account.
* <error>User not found</error> - User not found by param email_to_user_id.
*** <error>User not found</error> - User not found by param email_to_user_id.
* <error>Configuration error. Please consult this help link. (Net::SMTPFatalError - 554 5.7.1 ... </error> - SMTP error. Form more SMTP errors visit : http://wiki.kolmisoft.com/index.php/GUI_Error_-_Email_SMTP
*** <error>Configuration error. Please consult this help link. (Net::SMTPFatalError - 554 5.7.1 ... </error> - SMTP error. Form more SMTP errors visit : http://wiki.kolmisoft.com/index.php/GUI_Error_-_Email_SMTP
* <email_sending_status>E-mail has been disabled</email_sending_status> - Turn on email sending in Settings.
*** <email_sending_status>E-mail has been disabled</email_sending_status> - Turn on email sending in Settings.
<br><br>
<br><br>
----
 
*Example:
=See also=
**We have email_name = registration_confirmation_for_user, email_to_user_id = 142, login_username = new_first_name, login_url = www.kolmisoft.com, server_ip = 127.0.0.2, API key = 123456
 
**We send:
* [[MOR API]]
*** /api/send_email?u=admin&p=admin1&email_name=registration_confirmation_for_user&email_to_user_id=142&login_username=new_first_name&login_url=www.kolmisoft.com&server_ip=127.0.0.2&hash=565582398d663e87b5fe3a523f8937fb693bf1e1
'''* Note that username and password are not included in hash'''
**We recive in email:
*** Your device settings: Server IP: 127.0.0.2 Device type: Username: Password: ---- Settings to login to MOR interface: Login URL: www.kolmisoft.com Username: new_first_name Password: Thank you for registering!

Latest revision as of 12:12, 12 January 2014

Description

MOR API Send Email

Usage

  • From MOR X4 call: /api/email_send
  • For Backwards-compatibility old name 'send_email' is also usable. Call: /api/send_email
  • Methods: POST, GET(if allowed, not recomended)



Parametres


NOTE. If in email template there are used some parameters and you do not send them over API, client will get email with empty spaces instead of those parameters. Before sending email over API, be sure that you send all parameters used in email template.

Request

We have email_name = registration_confirmation_for_user, email_to_user_id = 142, login_username = new_first_name, login_url = www.kolmisoft.com, server_ip = 127.0.0.2, API key = 123456

We send:

HTML POST: http://<SERVER_IP>/billing/api/email_send?u=username&email_name=registration_confirmation_for_user&email_to_user_id=142&login_username=new_first_name&login_url=www.kolmisoft.com&server_ip=127.0.0.2&hash=565582398d663e87b5fe3a523f8937fb693bf1e1


NOTE that username are not included in hash

We recive in email:

Your device settings: Server IP: 127.0.0.2 Device type: Username: Password: ---- Settings to login to MOR interface: Login URL: www.kolmisoft.com Username: new_first_name Password: Thank you for registering!

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <email_sending_status>Email sent</email_sending_status>
</page>




Errors

  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Bad login</error>
  • <error>Email not found</error> - Email not found by supplied name in param email_name under logged user account.
  • <error>User not found</error> - User not found by param email_to_user_id.
  • <error>Configuration error. Please consult this help link. (Net::SMTPFatalError - 554 5.7.1 ... </error> - SMTP error. Form more SMTP errors visit : http://wiki.kolmisoft.com/index.php/GUI_Error_-_Email_SMTP
  • <email_sending_status>E-mail has been disabled</email_sending_status> - Turn on email sending in Settings.



See also