How to call script in Rest api with url

Hello Experts,

Please help me in below 2 queries....

Query1: How to call a script in rest api with parameters, please provide an example with URL'S...

Query2: How to send a request with an sql query in rest api, we can achieve it or not via sql query based

sample query :  select ads.cn, p.internalname from adsaccount ads join person p on ads.uid_person=p.uid_person

By using above sample query can we get a response via rest api....

Thank in Advance............