Configuration

Globals

Collection-wide Portman settings for variables, scripts, search and replace, request ordering, variable casing and authorization.

The globals section of the Portman config applies to the whole Postman collection. Use it for collection variables, collection-level scripts, mass search and replace, request and folder ordering, variable casing and collection-wide authorization.

Example

json
{  "version": 1.0,  "globals": {    "stripResponseExamples": true,    "collectionPreRequestScripts": [      "pm.collectionVariables.set('status', pm.iterationData.get('status') || 'open')"    ],    "collectionTestScripts": [      "pm.collectionVariables.set('applicationId', pm.iterationData.get('applicationId') || '1111');"    ],    "collectionVariables": {      "name": "portman",      "version": "1"    },    "keyValueReplacements": {      "x-apideck-app-id": "{{applicationId}}"    },    "valueReplacements": {      "<Bearer Token>": "{{bearerToken}}"    },    "rawReplacements": [      {        "searchFor": "Unify",        "replaceWith": "Unify ApiDeck"      }    ],    "portmanReplacements": [      {        "searchFor": "]::",        "replaceWith": "]:-:"      }    ]  }}

Options

OptionDescription
stripResponseExamplesDefault false. Strip the response examples from the generated collection, which keeps it compact when you generate many variations.
variableCasingCasing of auto-generated Postman variable names: camelCase, pascalCase, kebabCase, trainCase, snakeCase, adaCase, constantCase, cobolCase, dotNotation.
separatorSymbolDefault ::. Separator in generated test names, for example [GET]::/crm/leads - Status code is 2xx. Helpful with the postman-to-k6 converter.
collectionPreRequestScriptsArray of scripts run before every request. Script content or a file: path.
collectionTestScriptsArray of scripts run after every request. Script content or a file: path.
collectionVariablesMap of key value pairs added as Postman collection variables.
keyValueReplacementsMap of parameter key names whose values are replaced with the given Postman variables.
valueReplacementsMap of values replaced with the given values.
rawReplacementsSearch and replace on the OpenAPI data before Portman generates tests.
portmanReplacementsSearch and replace on the final generated collection right before it is written.
orderOfOperationsList of operations used to sort requests within each folder.
orderOfFoldersList of folder names used to sort folders.
securityOverwritesAuthorization for the whole collection.

Replacements

  • keyValueReplacements: any key matching x-apideck-app-id gets the value {{applicationId}} across the collection.
  • valueReplacements: any value matching <Bearer Token> becomes {{bearerToken}}.
  • rawReplacements: any string or object matching Unify becomes Unify ApiDeck, including descriptions. Changes are made before test generation, so they affect the generated tests.
  • portmanReplacements: runs on the final collection, so it can change anything Portman injected, such as test names or parts of the inlined JSON schema. The example above turns [GET]::/crm/leads test names into [GET]:-:/crm/leads.

Ordering

orderOfOperations sorts requests within their folder. Requests not in the list keep their current order.

json
{  "version": 1.0,  "globals": {    "orderOfOperations": [      "POST::/crm/leads",      "GET::/crm/leads/{id}",      "PATCH::/crm/leads/{id}",      "DELETE::/crm/leads/{id}",      "GET::/crm/leads"    ]  }}

orderOfFolders sorts folders by name. Folders not in the list keep their current order, after the re-ordered folders.

Variable casing

json
{  "version": 1.0,  "globals": {    "variableCasing": "snakeCase"  }}

With snakeCase, a variable named with the template <tag>Id for the Leads tag becomes leads_id. See Assign variables.

securityOverwrites

Overwrites the OpenAPI security scheme (apiKey, HTTP basic, HTTP bearer) or injects a Postman authorization type on collection level.

json
"securityOverwrites": {  "bearer": {    "token": "{{bearerToken}}"  }}
json
"securityOverwrites": {  "apiKey": {    "value": "{{apiKey}}"  }}

apiKey also accepts optional key and in (header or query).

json
"securityOverwrites": {  "basic": {    "username": "{{username}}",    "password": "{{password}}"  }}

Use { "remove": true } to unset the authorization.

Postman authorization types awsv4, digest, edgegrid, ntlm, oauth1 and oauth2 take an array of key, value and type (string or boolean) attributes. The easiest way to get them is to configure auth manually in Postman, export the collection and copy the values:

json
{  "globals": {    "securityOverwrites": {      "oauth1": [        {          "key": "addEmptyParamsToSign",          "value": true,          "type": "boolean"        },        {          "key": "consumerKey",          "value": "RKCGzna7bv9YD57c",          "type": "string"        },        {          "key": "signatureMethod",          "value": "HMAC-SHA1",          "type": "string"        },        {          "key": "version",          "value": "1.0",          "type": "string"        }      ]    }  }}

For authorization on specific requests, use overwriteRequestSecurity in overwrites.