Class Request


public class Request extends Item
Encapsulates a Postman collection request.

Postman SDK analog: Requestinvalid input: '<'/code.

  • Constructor Details

    • Request

      public Request(RequestBody req, String name)
      Create a request with the specific name and pre-populated RequestBody.
      Parameters:
      req - A RequestBody instance.
      name - The name of the request.
    • Request

      public Request(String name)
      Create an empety Request with the specific name
      Parameters:
      name - The name of the request.
  • Method Details

    • getRequestBody

      public RequestBody getRequestBody()
      Return the object containing the values in the request property, or null if this item does not contain a request (e.g., is a folder);
      Returns:
      RequestBody The request, or null if no request is defined.
    • setRequestBody

      public void setRequestBody(RequestBody request)
      Set the object containing the values in the request property
      Parameters:
      request -
    • getResponses

      public ArrayList<Response> getResponses()
      Return an ArrayList<Response> containing the values in the response property array, or null if none are defined.
      Returns:
      ArrayList<Response> The responses, or null if none are defined.
    • setResponses

      public void setResponses(ArrayList<Response> response)
      Set the ArrayList<Response> containing the values in the response property array. Passing null to this method removes the response array
      Parameters:
      response -
    • addResponse

      public void addResponse(Response resp)
      Add a Response object to the response array
      Parameters:
      resp - The new response
    • addResponse

      public void addResponse(String requestKey, Response response) throws InvalidCollectionActionException
      Add a response object to the request contained by this collection specified by requestKey
      Parameters:
      requestKey - Key identifying the request to add the response to
      response - New response to add to the request
      Throws:
      InvalidCollectionActionException - If the specifyed request is not contained by this collection