Interface Http

Http interface provided in the plugin api

interface Http {
    addAuthenticationHeader(value: string): void;
    addHeader(name: string, value: string): void;
    addParameter(name: string, value: string): void;
    addPassword(password: string): void;
    addUserName(name: string): void;
    execute(): ResponseInfo;
    performRequest(): string;
    reset(): void;
    setBody(body: string): void;
    setContentType(contentType: string): void;
    setMethod(method: HttpMethod): void;
    setProxyPassword(proxyPassword: string): void;
    setProxyURL(proxyURL: string): void;
    setProxyUser(proxyUser: string): void;
    setURL(url: string): void;
    toJsonArray(stringinJson: string): any[];
    toJsonObject(stringInJson: string): object;
}

Methods

  • Adds authentication header for the request.

    Parameters

    • value: string

      Value to set to the header

    Returns void

  • Adds header for the request.

    Parameters

    • name: string

      Name of the header

    • value: string

      Value to set to the header

    Returns void

  • Adds parameter for the request.

    Parameters

    • name: string

      Name of the parameter

    • value: string

      Value to set for the parameter

    Returns void

  • Sets password to credentials within rest request.

    Parameters

    • password: string

    Returns void

  • Sets username to credentials within rest request.

    Parameters

    • name: string

    Returns void

  • If all needed data is set, performs http request.

    Note that this method blocks further execution of the code.

    Returns ResponseInfo

    All information on the response

  • If all needed data is set, performs http request.

    Note that this method blocks further execution of the code.

    Returns string

    The response as string;

    Use Http.execute instead

  • Resets the values set to api.http to default values/empty values

    Returns void

  • Sets body for the request. By default it is JSON body.

    Parameters

    • body: string

    Returns void

  • Sets content type for the request. By default it is "application/json".

    Parameters

    • contentType: string

    Returns void

  • Sets request method type.

    Parameters

    Returns void

  • Sets password to proxy credentials.

    Parameters

    • proxyPassword: string

    Returns void

  • Sets proxy URL

    Parameters

    • proxyURL: string

    Returns void

  • Sets username to proxy credentials.

    Parameters

    • proxyUser: string

    Returns void

  • Sets URL to which the http call will be performed

    Parameters

    • url: string

    Returns void

  • Converts string if it is in json format to JSON array.

    Helper function to convert response to json if needed.

    Parameters

    • stringinJson: string

    Returns any[]

  • Converts string if it is in json format to JSON object.

    Helper function to convert response to json if needed.

    Parameters

    • stringInJson: string

    Returns object