Control relay from website - Arduino + Ethernet shield or NodeMCU

atulkatti:
I am planning a similar application. My sensor nodes in the field will send data like temp, humidity to a server and on the server it will analyze if the values are low or high and accordingly send a notification to user on android app. Then user will press a button to maybe turn the pump on. This signal should go to server and from there to a arduino relay connected to internet via GPRS module to turn pump on.

Could you explain how the server API can be written for this purpose

from 1. web page to server php (writing api) > 2 .writes to mysql db > 3. arduino code triggers the php (reading api ) to read what's written into db in stage number 2 4. the read data is sent to arduino as 'echo'