Skip to main content

Remote Access Tunnel

Overview

This tutorial walks through the 5-Tunnel-Mgmt collection — creating a remote access tunnel to a WEDA Node device, waiting for it to establish, and terminating it cleanly when done. Two requests in this collection use automatic polling to track tunnel state.

Prerequisites

Auto-captured Variables

VariableSet byUsed by
tunnelIdCreate TunnelGet Detail, Wait for ESTABLISHED, Terminate, Wait for TERMINATED

Steps

1. List Tunnels with Pagination

Lists all tunnel sessions for the current device, sorted by creation time (newest first).


2. Create Tunnel

Opens a new remote access tunnel session to the device. Fill in the request body with the tunnel type and target port before sending.

  • API: Create Tunnel Session
  • Script: saves tunnelId and deviceId as collection variables
  • Result: 202 Accepted

3. Get Tunnel Detail by ID

Retrieves the current status and connection details for the tunnel stored in tunnelId.


4. Wait for ESTABLISHED Status

Waits until the tunnel reaches ESTABLISHED state and its tunnelEndpoint is available.

Check until ready

Send this request again every few seconds until the tunnel status becomes ESTABLISHED and tunnelEndpoint has a value. Tunnel creation typically takes a few seconds to a minute depending on network conditions.

  • API: Get Tunnel Detail
  • Script: checks for ESTABLISHED with a tunnelEndpoint, and clears the polling variables once confirmed. The automatic retry it schedules only runs in Collection Runner or Newman
  • Result: tunnel status = ESTABLISHED with connection information available

Once established, use the connection details in the response to connect to the device via your preferred remote access client.


5. Terminate Tunnel

Closes the tunnel session stored in tunnelId.

note

Always terminate tunnels when you are done. Open tunnels consume connection resources on both the cloud and device sides.

  • API: Terminate Tunnel Session
  • Script: logs termination status and advances state for the next polling request
  • Result: 202 Accepted

6. Wait for TERMINATED Status

Waits until the tunnel is fully closed.

Check until ready

Same as step 4. Send the request again every few seconds until the tunnel status becomes TERMINATED.

  • API: Get Tunnel Detail
  • Script: polls until TERMINATED; clears all polling variables when done
  • Result: tunnel status = TERMINATED


Last updated on Aug-2, 2026 | Version 1.1.1