added $api_url as a constructor parameter