I wanted to create a script by using that I can check which service is being stopped or started at what time and from which IP the action (start and stop has been executed ) . is there some rest api to achieve the same ?
Yes, Ambari has a REST API. Documented here: https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md
However I don't think it has exactly what you are looking for - you will not be able to retrieve the IP address of the user performing any actions. It is also a polling mechanism rather than a publish/subscribe mechanism, so you will have to ask it what the state of a particular service is to receive an answer. This is in contrast to your ask, which is to be notified when a service changes state.
You can probably accomplish what you are asking for through Ambari Alerts paired with the Ambari REST API.
Here are some examples of common actions: https://community.hortonworks.com/articles/81353/popular-ambari-rest-api-commands.html
Here's another example, using the REST API with Ambari Alerts: https://community.hortonworks.com/questions/9124/ambari-alert-rest-api-to-filter-out-services-on-ma....