public static Map<String, String> postDataAPI(
      EndPointInfo apiUtilities, Map<String, String> headers) throws IDPTokenManagerException {
    HTTP_METHODS httpMethod = apiUtilities.getHttpMethod();
    String url = apiUtilities.getEndPoint();
    Map<String, String> params = apiUtilities.getRequestParamsMap();

    Map<String, String> responseParams = new HashMap<String, String>();
    HttpClient httpclient = getCertifiedHttpClient();
    String payload = buildPayload(params);

    if (httpMethod.equals(HTTP_METHODS.POST)) {
      HttpPost httpPost = new HttpPost(url);
      HttpPost httpPostWithHeaders = (HttpPost) buildHeaders(httpPost, headers, httpMethod);
      byte[] postData = payload.getBytes();
      try {
        httpPostWithHeaders.setEntity(new ByteArrayEntity(postData));
        HttpResponse response = httpclient.execute(httpPostWithHeaders);
        String status = String.valueOf(response.getStatusLine().getStatusCode());

        responseParams.put(Constants.SERVER_RESPONSE_BODY, getResponseBody(response));
        responseParams.put(Constants.SERVER_RESPONSE_STATUS, status);
        return responseParams;
      } catch (ClientProtocolException e) {
        throw new IDPTokenManagerException("Invalid client protocol.", e);
      } catch (IOException e) {
        responseParams.put(Constants.SERVER_RESPONSE_BODY, "Internal Server Error");
        responseParams.put(Constants.SERVER_RESPONSE_STATUS, Constants.INTERNAL_SERVER_ERROR);
        throw new IDPTokenManagerException("Server connectivity failure.", e);
      }
    }

    return responseParams;
  }
  public static Map<String, String> postData(EndPointInfo apiUtilities, Map<String, String> headers)
      throws IDPTokenManagerException {

    HTTP_METHODS httpMethod = apiUtilities.getHttpMethod();
    String url = apiUtilities.getEndPoint();
    JSONObject params = apiUtilities.getRequestParams();
    Map<String, String> responseParams = new HashMap<String, String>();

    switch (httpMethod) {
      case GET:
        responseParams = sendGetRequest(url, params, headers);
        break;
      case POST:
        responseParams = sendPostRequest(url, params, headers);
        break;
    }

    return responseParams;
  }