code: protected <T> T performCustomRequest(String url, Object requestPayLoad, Class<T> returnType, Map<String, String> uriVariables,
                                         HttpMethod httpMethod, HttpHeaders headers) {
  
          if (headers == null) {
              headers = new HttpHeaders();
          }
  
          HttpEntity<Object> requestEntity = new HttpEntity<Object>(requestPayLoad, headers);
  
          int tryNumber = 1;
          while(tryNumber <= API_RETRY) {
              try {
                  ResponseEntity<T> responseEntity = restTemplate.exchange(url, httpMethod, requestEntity, returnType, uriVariables);
                  return responseEntity.getBody();
              } catch (HttpStatusCodeException error) {
                  boolean isTooManyRequestsError = handleHttpStatusCodeError(uriVariables, tryNumber, error);
                  if (isTooManyRequestsError) {
                      try {
                          Thread.sleep(1000);
                      } catch (InterruptedException e) {
                          log.error("Error in performCustomRequest", e);
                      }
                  } else {
                      tryNumber++;
                  }
              } catch (RuntimeException e) {
                  handleApiError(tryNumber, e);
                  tryNumber++;
              }
          }
  
          throw new RestApiException("Error posting " + returnType.getSimpleName() + " url variables " + uriVariables.toString());
      }
docs: Performs a request to the passed in url of the passed in HttpMethod type (POST, GET, PUT etc).
  
  @param url
  @param requestPayLoad
  @param returnType
  @param uriVariables
  @param httpMethod
  @param headers        the headers for the request
  @return