Pulling organisationunits using WebAPI

Hi all

I need to be guided on how i can retrieve information from the database using API. Specifically, is there a way i can get the same output using API of the following queries?

Query1:

SELECT organisationunitid FROM usermembership WHERE userinfoid IN
														(SELECT userid FROM users WHERE username='$username')
														ORDER BY organisationunitid ASC

**Query2:**
SELECT organisationunitid FROM usermembership
														WHERE userinfoid IN
														(SELECT userinfoid FROM userinfo WHERE
														phonenumber='$number' OR phonenumber='$number2')