def api_post_request(url_prefix, form_data = {}, raw_response = false)
      retries = @crumb_max_retries
      begin
        refresh_crumbs

        # Added form_data default {} instead of nil to help with proxies
        # that barf with empty post
        request = Net::HTTP::Post.new("#{@jenkins_path}#{url_prefix}")
        @logger.debug "POST #{url_prefix}"
        if @crumbs_enabled
          request[@crumb["crumbRequestField"]] = @crumb["crumb"]
        end
        request.set_form_data(form_data)
        response = make_http_request(request)
        if raw_response
          handle_exception(response, "raw")
        else
          handle_exception(response)
        end
      rescue Exceptions::ForbiddenException => e
        refresh_crumbs(true)

        if @crumbs_enabled
          @logger.info "Retrying: #{@crumb_max_retries - retries + 1} out of" +
            " #{@crumb_max_retries} times..."
          retries -= 1

          if retries > 0
            retry
          else
            raise Exceptions::ForbiddenWithCrumb.new(@logger, e.message)
          end
        else
          raise
        end
      end
    end
def api_post_request(url_prefix, form_data = {}, raw_response = false)
      retries = @crumb_max_retries
      begin
        refresh_crumbs

        # Added form_data default {} instead of nil to help with proxies
        # that barf with empty post
        request = Net::HTTP::Post.new("#{@jenkins_path}#{url_prefix}")
        @logger.debug "POST #{url_prefix}"
        if @crumbs_enabled
          request[@crumb["crumbRequestField"]] = @crumb["crumb"]
        end
        request.set_form_data(form_data)
        response = make_http_request(request)
        if raw_response
          handle_exception(response, "raw")
        else
          handle_exception(response)
        end
      rescue Exceptions::ForbiddenException => e
        refresh_crumbs(true)

        if @crumbs_enabled
          @logger.info "Retrying: #{@crumb_max_retries - retries + 1} out of" +
            " #{@crumb_max_retries} times..."
          retries -= 1

          if retries > 0
            retry
          else
            raise Exceptions::ForbiddenWithCrumb.new(@logger, e.message)
          end
        else
          raise
        end
      end
    end
Sends a POST message to the Jenkins CI server with the specified URL

 @param [String] url_prefix The prefix to be used in the URL
 @param [Hash] form_data Form data to send with POST request
 @param [Boolean] raw_response Return complete Response object instead of
   JSON body of response

 @return [String] Response code form Jenkins Response