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
- Completed Get Access Token —
accessTokenis set - Completed Register Your Device —
deviceIdis set - The target device must be online and in
Activatedstatus
Auto-captured Variables
| Variable | Set by | Used by |
|---|---|---|
tunnelId | Create Tunnel | Get 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).
- API: List Device Tunnels
- Result:
200 OK
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
tunnelIdanddeviceIdas collection variables - Result:
202 Accepted
3. Get Tunnel Detail by ID
Retrieves the current status and connection details for the tunnel stored in tunnelId.
- API: Get Tunnel Detail
- Result:
200 OK
4. Wait for ESTABLISHED Status
Waits until the tunnel reaches ESTABLISHED state and its tunnelEndpoint is available.
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
ESTABLISHEDwith atunnelEndpoint, and clears the polling variables once confirmed. The automatic retry it schedules only runs in Collection Runner or Newman - Result: tunnel status =
ESTABLISHEDwith 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.
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.
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
Related
- For tunnel concepts and API details: Remote Access — Tunnel