SAS logoSAS® Mobile Investigator API
    Preparing search index...

    Interface SmiHttpApi

    This section of the API relates to the methods used to make HTTP requests.

    interface SmiHttpApi {
        addInterceptor(interceptor: HttpInterceptor): void;
        delete(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        delete<R>(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        delete(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        get(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        get<R>(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        get(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        head(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
            },
        ): Promise<HttpResponse<null>>;
        options(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        options<R>(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        options(
            url: string,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        patch(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        patch<R>(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        patch(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        post(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        post<R>(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        post(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        put(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        put<R>(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        put(
            url: string,
            body: any,
            options?: {
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
        request(
            method: string,
            url: string,
            options?: {
                body?: any;
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "text";
            },
        ): Promise<HttpResponse<string>>;
        request<R>(
            method: string,
            url: string,
            options?: {
                body?: any;
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "json";
            },
        ): Promise<HttpResponse<R>>;
        request(
            method: string,
            url: string,
            options?: {
                body?: any;
                headers?: Record<string, string | string[]>;
                params?: Record<string, string | string[]>;
                responseType: "blob";
            },
        ): Promise<HttpResponse<Blob>>;
    }
    Index

    Methods

    • Constructs a DELETE request that interprets the body as a text stream and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse, with the response body of type string.

      window.sas.smi.util.http.delete("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a DELETE request that interprets the body as a JSON object and returns an HttpResponse.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse, with the response body of the requested type.

      window.sas.smi.util.http.delete<SmiPageFilesResponse>("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a DELETE request that interprets the body as a Blob and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse, with the response body of type Blob.

      window.sas.smi.util.http.delete("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a GET request that interprets the body as a text stream and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse for the request, with the response body of type string.

      window.sas.smi.util.http.get("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a GET request that interprets the body as a JSON object and returns an HttpResponse.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse for the request, with a response body of the requested type.

      window.sas.smi.util.http.get<SmiPageFilesResponse>("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a GET request that interprets the body as a Blob and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse for the request, with the response body of type Blob.

      window.sas.smi.util.http.get("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a HEAD request that returns a null body and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

      Returns Promise<HttpResponse<null>>

      A Promise of the HttpResponse for the request, with the response body of null.

      window.sas.smi.util.http.head("http://www.my.test.url",
      { params: { firstParam : "testParam" } }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs an OPTIONS request that interprets the body as text stream and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse for the request, with the response body of type string.

      window.sas.smi.util.http.options("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs an OPTIONS request that interprets the body as a JSON object and returns an HttpResponse.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse for the request, with the response body of the requested type.

      window.sas.smi.util.http.options<SmiPageFilesResponse>("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs an OPTIONS request that interprets the body as a Blob and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse for the request, with the response body of type Blob.

      window.sas.smi.util.http.options("http://www.my.test.url",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PATCH request that interprets the body as a text stream and returns the full HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse for the request, with a response body of type string.

      window.sas.smi.util.http.patch("http://www.my.test.url",
      "This is the body of my PATCH request",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PATCH request that interprets the body as a JSON object and returns an HttpResponse.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse for the request, with a response body in the requested type.

      window.sas.smi.util.http.patch<SmiPageFilesResponse>("http://www.my.test.url",
      "This is the body of my PATCH request",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PATCH request that interprets the body as a Blob and returns the full HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse for the request, with a response body of type Blob.

      window.sas.smi.util.http.patch("http://www.my.test.url",
      "This is the body of my PATCH request",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));

    post

    • post(
          url: string,
          body: any,
          options?: {
              headers?: Record<string, string | string[]>;
              params?: Record<string, string | string[]>;
              responseType: "text";
          },
      ): Promise<HttpResponse<string>>

      Constructs a POST request that interprets the body as a text stream and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse for the request, with a response body of type string.

      window.sas.smi.util.http.post("http://www.my.test.url",
      "This is the body of my POST request",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • post<R>(
          url: string,
          body: any,
          options?: {
              headers?: Record<string, string | string[]>;
              params?: Record<string, string | string[]>;
              responseType: "json";
          },
      ): Promise<HttpResponse<R>>

      Constructs a POST request that interprets the body as a JSON object and returns an HttpResponse.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse for the request, with a response body of the requested type.

      window.sas.smi.util.http.post<SmiPageFilesResponse>("http://www.my.test.url",
      "This is the body of my POST request",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • post(
          url: string,
          body: any,
          options?: {
              headers?: Record<string, string | string[]>;
              params?: Record<string, string | string[]>;
              responseType: "blob";
          },
      ): Promise<HttpResponse<Blob>>

      Constructs a POST request that interprets the body as a Blob and returns an HttpResponse.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse for the request, with a response body of type Blob.

      window.sas.smi.util.http.post("http://www.my.test.url",
      "This is the body of my POST request",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PUT request that interprets the body as a text stream and returns the full HTTP response.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse for the request, with a response body of type string.

      window.sas.smi.util.http.put("http://www.my.test.url",
      "This is the body of my PUT request",
      { params: { firstParam : "testParam" }, responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PUT request that interprets the body as a JSON object and returns an HTTP response.

      Type Parameters

      • R

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse for the request, with a response body of the requested type.

      window.sas.smi.util.http.put<SmiPageFilesResponse>("http://www.my.test.url",
      "This is the body of my PUT request",
      { params: { firstParam : "testParam" }, responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a PUT request that interprets the body as a Blob and returns the full HTTP response.

      Parameters

      • url: string

        {string} The endpoint URL.

      • body: any

        {any | null} The content to send with the request.

      • Optionaloptions: {
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse for the request, with a response body of type Blob.

      window.sas.smi.util.http.put("http://www.my.test.url",
      "This is the body of my PUT request",
      { params: { firstParam : "testParam" }, responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a request which interprets the body as a string and returns an HttpResponse with the response body in the requested type.

      Parameters

      • method: string
      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            body?: any;
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "text";
        }

        {Object} The HTTP options to send with the request.

        • Optionalbody?: any

          {any | null} The content to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "text"

          {"text"} The format the response is returned as.

      Returns Promise<HttpResponse<string>>

      A Promise of the HttpResponse, with the response body of type string.

      window.sas.smi.util.http.request("http://www.my.test.url",
      {
      body: "This is the body of my REQUEST",
      params: { firstParam : "testParam" },
      responseType: "text" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a request which interprets the body as a JSON object and returns an HttpResponse with the response body in the requested type.

      Type Parameters

      • R

      Parameters

      • method: string
      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            body?: any;
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "json";
        }

        {Object} The HTTP options to send with the request.

        • Optionalbody?: any

          {any | null} The content to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "json"

          {"json"} The format the response is returned as.

      Returns Promise<HttpResponse<R>>

      A Promise of the HttpResponse, with the response body of the requested type.

      window.sas.smi.util.http.request<SmiPageFilesResponse>("http://www.my.test.url",
      {
      body: "This is the body of my REQUEST",
      params: { firstParam : "testParam" },
      responseType: "json" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));
    • Constructs a request which interprets the body as a Blob and returns an HttpResponse with the response body in the requested type.

      Parameters

      • method: string
      • url: string

        {string} The endpoint URL.

      • Optionaloptions: {
            body?: any;
            headers?: Record<string, string | string[]>;
            params?: Record<string, string | string[]>;
            responseType: "blob";
        }

        {Object} The HTTP options to send with the request.

        • Optionalbody?: any

          {any | null} The content to send with the request.

        • Optionalheaders?: Record<string, string | string[]>

          {Record<string, string | string[]>} The headers to send with the request.

        • Optionalparams?: Record<string, string | string[]>

          {Record<string, string | string[]>} The parameters to send with the request.

        • responseType: "blob"

          {"blob"} The format the response is returned as.

      Returns Promise<HttpResponse<Blob>>

      A Promise of the HttpResponse, with the response body of type Blob.

      window.sas.smi.util.http.request("http://www.my.test.url",
      {
      body: "This is the body of my REQUEST",
      params: { firstParam : "testParam" },
      responseType: "blob" }
      ).then(response => console.log(response))
      .catch(err => console.log(err));