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 ?
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.