Using WordPress RESTapi to call a php file instead of post or page
I’ve used WordPress for a few years now and I’m wanting to set up a WordPress instance and use it for API calls. I’ve never used the RESTapi capabilities of WordPress before. I’ve done some tutorials and can call pages and post. Instead of calling a page or a post I just want to do a POST request to a file instead that will then run some logic.
My projects goal is going to have videos using iframes running on other peoples webpage and when a user hits play on that video it will do an AJAX call to the API and post some details like the video id, name, website it was watched on ect. I want the logic to then email a customer who filmed that video.
I will use the backend to create a DB of users relevant to the video Ids.
Is this the correct use for the RESTapi and can I call just a file instead of posts and pages or should I be doing this another way? I’m not wanting a front-end for this instance. Just CMS and api calls.