Skip to main content
Version: Current

Web Actions

  • web.get(url: string, options?: WebhookOptions): Promise<WebhookResult>

    Sends a HTTP GET request for the given URL using the given options.

    The first parameter is a string and is the URL that the request should be sent to.

    The second parameter is optional and is a WebhookOptions and is the options for the request.

    Examples
    Send a HTTP GET request for https://example.com and toast the result.
    const response = await web.get('https://example.com');
    os.toast(response);
  • web.hook(options: WebhookOptions): Promise<WebhookResult>

    Sends a HTTP request using the given options.

    The first parameter is a WebhookOptions and is the options for the request.

    Examples
    Send a HTTP GET request to https://example.com and toast the result.
    const response = await web.hook({
    method: 'GET',
    url: 'https://example.com',
    });
    os.toast(response);
    Send a HTTP PUT request to https://example.com with some data.
    web.hook({
    method: 'PUT',
    url: 'https://example.com',
    data: {
    some: 'data'
    }
    });
  • web.post(url: string, data?: any, options?: WebhookOptions): Promise<WebhookResult>

    Sends a HTTP POST request to the URL with the given data and using the given options.

    The first parameter is a string and is the URL that the request should be sent to.

    The second parameter is optional and is a any and is the data that should be included in the request.

    The third parameter is optional and is a WebhookOptions and is the options for the request.

    Examples
    Send a HTTP POST request to https://example.com and toast the result.
    const response = await web.post('https://example.com', {
    some: 'data'
    });
    os.toast(response);