Path variable, but not starting at slash (/)

Hi,

Was wandering if there is a way to make Postman recognise colon-syntax path variables that do not start at the slash. The API I’m working with uses the following notation a lot:

https://some.host/path/to/api/code={objectCode}

but the attempt to use it with the colon-syntax

https://some.host/path/to/api/code=:objectCode

seems to confuse Postman and does not yield expected results (which is of course recognising objectCode as one of the Path Variables)

Hi @gauntlet-pl. Welcome to the Postman Community:postman_logo.

The column syntax isn’t a standardized form or describing URLs, and it seems like it is specific to the API you’re working with. : are typically used to specify the port in a URL. Are there other standardized options available for you to explore on this API?

Hi @gbadebo-bello, thank you for your answer.

The colon syntax is a feature offered by the Postman desktop app for defining path variables within your API’s URL

image

Hi @lunar-module-partic4. The example you have shown includes the use of a dynamic path parameter(path variable) named workingVariable.

This path parameter immediately precedes a forward slash, which is the expected and standard form for it in URLs.

Contrary to this, the ignoredVariable is not a path parameter or variable because the : is not preceding a forward slash. The path here will be /code=:ignoredVariable, which is static and can be made dynamic by adding a : before it which will make /:code=:ignoredVariable the variable name and a value can be specified for that.

The URL specification allows the inclusion of special characters like :, = in path parameters although they will have different meaning when used in other places like in a query parameter for example where = seperates the key and it’s corresponding value.

@gauntlet-pl

Another idea is for you to use actual variables in your URL if you need to maintain that structure.

https://some.host/path/to/api/code=:{{objectCodeVariable}}

Using variable (mustache) notation is not really an option as I have over a hundred endpoints like that and keeping over a hundred collection variables is not really the kind of environment that I’d like to create.

But, what I take from your response is that, by design, Postman currently do not support path variables that follow any character other than forward slash. Is there a place where I can request such feature?

Hi @gauntlet-pl.

You can make a feature request here

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.