Email Notification on Add through REST API

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
josejad
User
Posts: 117
Location: Spain

Email Notification on Add through REST API

Post by josejad »

Hi everyone:

Just testing the REST API (I have no experience with rest api). I'm testing from an android app, I updated the db directly before, and I'd like to do it through the REST API. Is there any way of triggering the "on add email notification" when add a row with the API?
I can't see advantages if I can't trigger events for using the REST API instead of connect directly to the database (but I guess there must be advantages)

Thanks in advance.


mobhar
User
Posts: 11741

Post by mobhar »

Please try it by yourself first, and post your code for more discussion. In addition, please always read related topic from manual or Help menu of PHPMaker application for more info and your references.


josejad
User
Posts: 117
Location: Spain

Post by josejad »

Thanks Mohar. I will check it again, bit I,ve read the help several times and I can’t find anything related to server events with REST API.
I get the email if I insert from the browser but not if I make with REST API


josejad
User
Posts: 117
Location: Spain

Post by josejad »

Sorry, I mean Mobhar in last post.

If I use in my app or in the browser the URL:

localhost/peru/api/?action=add&object=tareas&descripcion=TEST&fecha=2019-04-17&asignada=SI&completada=NO

I get:
{"success":true,"tareas":{"id":11},"version":"15.0.9"}

but I don't get the email, but I get it if I insert through the ADD button. I can't find related topics in help


mobhar
User
Posts: 11741

Post by mobhar »

You may create your own API function (see "REST API" -> "Create Your Own API Action" -> "Example 1" from PHPMaker Help menu). Inside that API Function, then just call a global function for sending email: "SendEmail" see the code from the generated "phpfn15.php" file.


josejad
User
Posts: 117
Location: Spain

Post by josejad »

Thanks again. I didn't know if it was a default option.
I will investigate the way you say


Post Reply