updated get in api.js to handle n sub docs