API for working with the HTTP proxy in the Studio Pro backend.

This API allows components to request a proxy URL that can be used to make requests to external web resources through the Studio Pro backend, which can be useful for bypassing CORS restrictions.

interface IHttpProxyApi {
    _apiId: "mendix.HttpProxyApi";
    addEventListener<K>(eventType: K, listener: EventHandler<{}, K>): DisposeListener;
    getProxyUrl(targetUrl: string): Promise<string>;
    removeEventListener<K>(eventType: K, listener: EventHandler<{}, K>): void;
}

Hierarchy (view full)

Properties

_apiId

Unique identifier for the HttpProxy API.

Methods

  • Adds an event listener for the specified event type.

    Type Parameters

    • K extends never

    Parameters

    • eventType: K

      The type of event to listen for.

    • listener: EventHandler<{}, K>

      The event listener to add.

    Returns DisposeListener

    A function that can be called to remove the event listener.

  • Gets a proxy URL for the given target URL.

    This API allows components to request a proxy URL for a given target URL. The proxy URL can be used to make requests to the target endpoint through the Studio Pro backend, which can be useful for bypassing CORS restrictions.

    Parameters

    • targetUrl: string

      The URL to proxy.

    Returns Promise<string>

    A promise that resolves to the proxy URL. This URL can be used to make requests to the target endpoint through the Studio Pro backend.

  • Removes an event listener for the specified event type.

    Type Parameters

    • K extends never

    Parameters

    • eventType: K

      The type of event to remove the listener from.

    • listener: EventHandler<{}, K>

      The event listener to remove.

    Returns void