Interface HttpService

All Superinterfaces:
Service

public interface HttpService extends Service
Provides methods to make HTTP requests.
  • Method Details

    • newLocalHttpRequest

      @Deprecated HttpRequest newLocalHttpRequest()
      Deprecated.
      Create a new HTTP request to represent a connection to the current Vault as the current user.
      Returns:
      local HTTP request
    • isLocalHttpRequestAllowed

      boolean isLocalHttpRequestAllowed(RequestContextUserType requestContextUserType)
      Indicates whether local access is available for the provided RequestContextUserType. If true, the user type can create local HTTP requests.
      Parameters:
      requestContextUserType - the user type to check access for
      Returns:
      true if local access is available for the provided user type
    • newLocalHttpRequest

      @Deprecated HttpRequest newLocalHttpRequest(RequestContextUserType requestContextUserType)
      Deprecated.
      as of 24R1.1, replaced by {@link #newHttpRequestBuilder().withLocalConnection(RequestContextUserType}.
      Create a new HTTP request to represent a connection to the current vault as the provided user type. If it is unclear whether the local request will succeed for the provided user type, call the isLocalHttpRequestAllowed(RequestContextUserType) method prior to calling this method.
      Parameters:
      requestContextUserType - user type establishing the HTTP request
      Returns:
      local HTTP request
    • newHttpRequest

      @Deprecated HttpRequest newHttpRequest(String connectionName)
      Deprecated.
      as of 24R1.1, replaced by {@link #newHttpRequestBuilder().withConnectionName()}.
      Create a new HTTP request corresponding to the given connectionName (local, Vault to Vault, or external connection).
      Parameters:
      connectionName - name of a local, Vault to Vault, or external connection. Must be a connection with "active" lifecycle state. Cannot be null or empty.
      Returns:
      HttpRequest
    • newHttpRequestBuilder

      FormHttpRequest.Builder newHttpRequestBuilder()
      Returns:
      FormHttpRequest.Builder
    • send

      @Deprecated <T> HttpOperation<T> send(HttpRequest httpRequest, HttpResponseBodyValueType<T> valueType)
      Deprecated.
      Creates an operation to send the specified HTTP request and convert the response body to the given valueType.

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, STRING).ignoreError().execute()

      Type Parameters:
      T - HTTP response body type
      Parameters:
      httpRequest - HTTP request to execute. Cannot be null.
      valueType - the type to which response body must be converted to. Cannot be null.
      Returns:
      an operation used to execute the HTTP request
    • sendRequest

      <T> HttpOperation<T> sendRequest(HttpWebRequest httpRequest, HttpResponseBodyValueType<T> valueType)
      Creates an operation to send the specified HTTP request and convert the response body to the given valueType.

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, STRING).ignoreError().execute()

      Type Parameters:
      T - HTTP response body type
      Parameters:
      httpRequest - HTTP request to execute. for example, FormHttpRequest, Cannot be null.
      valueType - the type to which response body must be converted to. Cannot be null.
      Returns:
      an operation used to execute the HTTP request
    • send

      @Deprecated HttpOperation<CsvData> send(HttpRequest httpRequest, CsvReadParameters csvReadParameters)
      Deprecated.
      Creates an operation to send the specified HTTP request and convert the response body specifically to CsvData using the given custom csvReadParameters.

      If there is no need to customize CsvReadParameters, you may simply use send(HttpRequest, HttpResponseBodyValueType).

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, csvReadParameters).ignoreError().execute()

      Parameters:
      httpRequest - httpRequest to execute. Cannot be null.
      csvReadParameters - custom CSV read parameters to use to convert response body to CsvData. Cannot be null.
      Returns:
      an operation used to execute HTTP request
    • send

      @Deprecated <U extends UserDefinedModel> HttpOperation<U> send(HttpRequest httpRequest, Class<U> userDefinedModelResponseType)
      Deprecated.
      as of 24R1.1, replaced by sendRequest(HttpWebRequest, Class)
      Creates an operation to send the specified HTTP request and convert the response body to the given UserDefinedModel type. The response body's content type is expected to be JSON when using this method, because this is currently the only content type that is supported by User-Defined Models.

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, STRING).ignoreError().execute()

      Type Parameters:
      U - type of UserDefinedModel
      Parameters:
      httpRequest - HTTP request to execute. Cannot be null.
      userDefinedModelResponseType - the User-Defined-Model class to which response body must be converted to. Cannot be null.
      Returns:
      an operation used to execute the HTTP request
    • sendRequest

      HttpOperation<CsvData> sendRequest(HttpWebRequest httpRequest, CsvReadParameters csvReadParameters)
      Creates an operation to send the specified HTTP request and convert the response body specifically to CsvData using the given custom csvReadParameters.

      If there is no need to customize CsvReadParameters, you may simply use sendRequest(HttpWebRequest, HttpResponseBodyValueType).

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, csvReadParameters).ignoreError().execute()

      Parameters:
      httpRequest - httpRequest to execute. for example, FormHttpRequest, Cannot be null.
      csvReadParameters - custom CSV read parameters to use to convert response body to CsvData. Cannot be null.
      Returns:
      an operation used to execute HTTP request
    • sendRequest

      <U extends UserDefinedModel> HttpOperation<U> sendRequest(HttpWebRequest httpRequest, Class<U> userDefinedModelResponseType)
      Creates an operation to send the specified HTTP request and convert the response body to the given UserDefinedModel type. The response body's content type is expected to be JSON when using this method, because this is currently the only content type that is supported by User-Defined Models.

      You can specify the ways success and error are handled on the returned HttpOperation. Once success-handling and error-handling is specified, you can call HttpOperation.execute() to send the HTTP request. For example:

       
       httpService.send(httpRequest, STRING).ignoreError().execute()

      Type Parameters:
      U - type of UserDefinedModel
      Parameters:
      httpRequest - HTTP request to execute. for example, FormHttpRequest, Cannot be null.
      userDefinedModelResponseType - the User-Defined-Model class to which response body must be converted to. Cannot be null.
      Returns:
      an operation used to execute the HTTP request