docs: def _rest_request_to_json(self, url, instance, object_path, tags, *args, **kwargs):
          """
          Query the given URL and return the JSON response
          """
          service_check_tags = ['url:{}'.format(self._get_url_base(url))] + tags
          service_check_tags = list(set(service_check_tags))
  
          if object_path:
              url = self._join_url_dir(url, object_path)
  
          # Add args to the url
          if args:
              for directory in args:
                  url = self._join_url_dir(url, directory)
  
          auth = None
  
          # Authenticate our connection to JMX endpoint if required
          kerberos = instance.get('kerberos')
          username = instance.get('username')
          password = instance.get('password')
          if username is not None and password is not None:
              auth = (username, password)
          elif kerberos is not None:
              if kerberos not in KERBEROS_STRATEGIES:
                  raise Exception('Invalid Kerberos strategy `{}`'.format(kerberos))
  
              auth = requests_kerberos.HTTPKerberosAuth(
                  mutual_authentication=KERBEROS_STRATEGIES[kerberos],
                  delegate=is_affirmative(instance.get('kerberos_delegate', False)),
                  force_preemptive=is_affirmative(instance.get('kerberos_force_initiate', False)),
                  hostname_override=instance.get('kerberos_hostname'),
                  principal=instance.get('kerberos_principal'),
              )
  
          ssl_verify = is_affirmative(instance.get('ssl_verify', True))
  
          old_keytab_path = None
          if 'kerberos_keytab' in instance:
              old_keytab_path = os.getenv('KRB5_CLIENT_KTNAME')
              os.environ['KRB5_CLIENT_KTNAME'] = instance['kerberos_keytab']
  
          self.log.debug('Attempting to connect to "{}"'.format(url))
  
          # Add kwargs as arguments
          if kwargs:
              query = '&'.join(['{}={}'.format(key, value) for key, value in iteritems(kwargs)])
              url = urljoin(url, '?' + query)
  
          try:
              response = requests.get(url, auth=auth, verify=ssl_verify, timeout=self.default_integration_http_timeout)
              response.raise_for_status()
              response_json = response.json()
  
          except Timeout as e:
              self.service_check(
                  SERVICE_CHECK_NAME,
                  AgentCheck.CRITICAL,
                  tags=service_check_tags,
                  message="Request timeout: {}, {}".format(url, e),
              )
              raise
  
          except (HTTPError, InvalidURL, ConnectionError, SSLError) as e:
              self.service_check(
                  SERVICE_CHECK_NAME,
                  AgentCheck.CRITICAL,
                  tags=service_check_tags,
                  message="Request failed: {}, {}".format(url, e),
              )
              raise
  
          except ValueError as e:
              self.service_check(SERVICE_CHECK_NAME, AgentCheck.CRITICAL, tags=service_check_tags, message=str(e))
              raise
  
          else:
              self.service_check(
                  SERVICE_CHECK_NAME,
                  AgentCheck.OK,
                  tags=service_check_tags,
                  message="Connection to {} was successful".format(url),
              )
  
              return response_json
  
          finally:
              if old_keytab_path is not None:
                  os.environ['KRB5_CLIENT_KTNAME'] = old_keytab_path