Skip to Content

Scripting example - IP address

This example demonstrates how to make an HTTP request from an default rule. The example retrieves the server's public IP address and defaults a cell value.

Table schema

Column Data Type Primary Key Auto-generate Nullable
IpAddress NVARCHAR(100) No No No


#r "System.Net.Http"

using System;
using System.Net.Http;

var client = new HttpClient();

const string url = "";

string ipAddress;

using (HttpResponseMessage response = await client.GetAsync(url))
    if (!response.IsSuccessStatusCode)
        const string message = "Failed to get IP address.";
        throw new InvalidOperationException(message);

    ipAddress = await response.Content.ReadAsStringAsync();

Row["IpAddress"].Value = ipAddress;