Vars Tab
The Vars tab manages path variables—dynamic segments in your URL path that get replaced with actual values before the request is sent. Path variables are identified by the colon prefix in the URL (e.g., :userId).
What Are Path Variables?
Path variables are placeholders within the URL path that represent dynamic values. Unlike query parameters, they are part of the path itself, not appended after a question mark.
URL Structure
https://api.example.com/users/:userId/posts/:postIdhttps://api.example.com/users/123/posts/456:) followed by the variable name. Valid names contain letters, numbers, and underscores.Port numbers excluded: All-numeric names (e.g., :8082 in http://localhost:8082/users/:id) are treated as port numbers, not path variables. Only names containing at least one non-digit character are detected, so :id appears in the Vars table but :8082 does not.Variable Table
The Vars tab displays a table where each row represents one path variable.
| Column | Description |
|---|---|
| Checkbox | Enable or disable the variable. When disabled, the :varName is removed from the URL. |
| Key | The variable name (without the colon). Changes here update the URL automatically. |
| Value | The value that replaces the variable when the request is sent. |
| Delete (X) | Removes the variable from both the table and the URL. |
Automatic Variable Detection
Atrahasis automatically detects path variables in your URL and populates the Vars tab.
How It Works
- Type a URL containing
:variableNamein the URL input - The Vars tab automatically creates rows for detected variables
- Enter values for each variable in the table
- When sent, variables are replaced with their values
Sync Behavior
- Adding a variable to the URL creates a new row in Vars
- Renaming a variable key updates the URL
- Deleting a row removes the variable from the URL
- Disabling a variable removes it from the URL (but keeps it in the table)
Required Variables Warning
Path variables must have values before sending. If you try to send a request with empty path variables, Atrahasis redirects you to the Vars tab with a warning.
Please set values for the required path variables before sending the request.
This prevents sending malformed URLs like /users/:userId to the server, which would result in a 404 or routing error.
Adding Variables Manually
You can add variables manually using the "Add Variable" button. When you add a variable and give it a key, the URL is updated to include /:key at the end.
Example
https://api.example.com/usershttps://api.example.com/users/:idUsing Environment Variables as Values
Path variable values can reference environment variables. This is useful for IDs that change between environments.
Example
| Key | Value |
|---|---|
| userId | {{testUserId}} |
| orderId | {{lastOrderId}} |
Environment variables are resolved before replacing path variables, so the final URL contains the actual values.
Common Patterns
Single Resource
/users/:userIdGet, update, or delete a specific user by ID.
Nested Resources
/users/:userId/posts/:postId/comments/:commentIdAccess resources that belong to other resources in a hierarchy.
Action Endpoints
/orders/:orderId/cancelPerform an action on a specific resource.
Version and Tenant
/api/:version/tenants/:tenantId/usersMulti-tenant APIs with versioning in the path.
Vars vs Params Comparison
| Aspect | Vars (Path Variables) | Params (Query Parameters) |
|---|---|---|
| Location | In the URL path | After the ? in URL |
| Syntax | :variableName | ?key=value |
| Required | Usually yes (identifies a resource) | Usually optional (filters, pagination) |
| Purpose | Resource identification | Filtering, sorting, configuration |
| Example | /users/123 | /users?page=1 |