Configuring collections and folders
Give a collection or folder variables, authentication, scripts and settings that its requests inherit.
Overview
Collections and folders can do more than group requests. Each one can carry variables, authentication, scripts and request settings, and every request inside it inherits them. Set an API's base URL and token once on its collection, and every request in the collection uses them.
Settings flow from the outside in: the workspace, then the collection, then each folder from the outermost to the innermost, then the request. Where two levels set the same thing, the one closer to the request wins.
Drafts aren't in a collection, so they skip collection and folder settings and use only their workspace's and the global ones.
Open Collection Settings
Collection and folder settings are edited in the Collection Settings window. To open it, Control-click a collection or folder in the sidebar and choose one of these:
- Edit Variables…
- Edit Auth…
- Edit Scripts…
The window opens on that collection or folder, with the matching tab selected. Its sidebar lists the workspace's collections and their folders. Select another one to edit it, and use the tabs in the toolbar to switch between Variables, Auth, Scripts and Settings (gear).
Icons beside each item in the sidebar show what it sets: a gear for request settings, a script icon for scripts, a lock for its own authentication (or a crossed-out lock when it turns authentication off), and the number of variables it defines.
You can also get here from a request. When a request inherits from a collection or folder, the request editor links to it: click Edit in the Auth tab, Edit… beside an inherited setting in the Settings tab, or a level in the Scripts tab's "Also runs" popover. Each opens that collection or folder in Collection Settings.
The Collection Settings window has its own undo history, separate from the main windows.
Define variables
Click Variables to edit the collection's or folder's variables. Click Add Variable to add a row, then enter a name and a value. Requests inside use them as {{name}}.
A folder's variables override its collection's, and an inner folder's override an outer folder's. The active environment sits between them: it overrides the collection's variables but not a folder's. For the full order, see Using variables.
Set authentication
Click Auth and choose an authentication type. Requests inside that are set to Inherit from Parent use it. Choose Inherit from Parent here to pass on whatever the level above uses, or No Auth to turn authentication off for everything inside.
For more information, see Inheriting authentication.
Add scripts
Click Scripts to write JavaScript that runs before each request inside the collection or folder is sent, or after its response arrives. Choose Before Request or After Response from the menu at the top.
A collection's scripts run first, then each folder's from the outermost in, then the request's own. Turn off Enabled to stop a level's scripts from running without deleting them. For more information, see Running scripts before and after requests.
Change request settings
Click the Settings tab (gear) to set the timeout, redirect behavior, proxy use and certificate checks for every request inside. Each setting starts out inheriting from the level above. When you change one, requests and folders inside inherit your value unless they set their own.
For more information, see Configuring request settings.
See Also
- Organizing requests into collections: Group requests into collections and folders, and move, copy and style them.
- Using variables: Insert values into requests with
{{name}}tokens and see where each value comes from. - Inheriting authentication: Set authentication once on a workspace, collection or folder and let requests inherit it.
- Running scripts before and after requests: Add pre-request and post-response scripts to requests, folders and collections.
- Configuring request settings: Set the timeout, redirect behavior, proxy and certificate checks for a request or a group of requests.