Rest API Method

Hi all,
Am trying to trigger a rest api with dynamic id eg: http://host:port/files/s209slkdlslklsdksl/ is it possible to get response from a py method in backend using (
id - s209slkdlslklsdksl
Here I want to intercept the id and hit the actual method in frappe using the url.