[GH-ISSUE #834] URL Path Parameters #293

Closed
opened 2026-03-16 14:23:03 +03:00 by kerem · 9 comments
Owner

Originally created by @sboulema on GitHub (May 1, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/834

Is your feature request related to a problem? Please describe.
I am trying to convert from Postman to Postwoman. I love that I have a proper API testing tool that I can use on my laptop and on my phone and keep everything in sync!
I do however miss the easy way of setting url path parameters as is possible in Postman.

Describe the solution you'd like
More info on how path parameters work in Postman:

Path parameters form part of the request URL, and are referenced using placeholders preceded by : as in the following example: /customer/:id

https://learning.postman.com/docs/postman/sending-api-requests/requests/#sending-parameters

Describe alternatives you've considered
Either a similar solution with a special character or maybe a dropdown next to the current query parameters to indicate if it is a query or path parameter.

Originally created by @sboulema on GitHub (May 1, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/834 **Is your feature request related to a problem? Please describe.** I am trying to convert from Postman to Postwoman. I love that I have a proper API testing tool that I can use on my laptop and on my phone and keep everything in sync! I do however miss the easy way of setting url path parameters as is possible in Postman. **Describe the solution you'd like** More info on how path parameters work in Postman: > Path parameters form part of the request URL, and are referenced using placeholders preceded by : as in the following example: /customer/:id https://learning.postman.com/docs/postman/sending-api-requests/requests/#sending-parameters **Describe alternatives you've considered** Either a similar solution with a special character or maybe a dropdown next to the current query parameters to indicate if it is a query or path parameter.
kerem 2026-03-16 14:23:03 +03:00
Author
Owner

@liyasthomas commented on GitHub (May 1, 2020):

Hi @sboulema, Glad you're making use of PW.

  1. To add path parameters, simply choose "Parameters tab" under request section and add parameters.

image

  1. There's also another way to append parameters that is to append parameters along the URL itself. Ex: https://httpbin.org/get?param1=true&param2=false

  2. You can even use Pre-request scripts to add/remove parameters

Read more on Pre-request scripts: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-Scripts.

Hope issue is solved.

<!-- gh-comment-id:622342632 --> @liyasthomas commented on GitHub (May 1, 2020): Hi @sboulema, Glad you're making use of PW. 1. To add path parameters, simply choose "Parameters tab" under request section and add parameters. ![image](https://user-images.githubusercontent.com/10395817/80800536-5b9d2700-8bc7-11ea-988f-3460de20210b.png) 2. There's also another way to append parameters that is to append parameters along the URL itself. Ex: `https://httpbin.org/get?param1=true&param2=false` 3. You can even use `Pre-request scripts` to add/remove parameters Read more on `Pre-request scripts`: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-Scripts. Hope issue is solved.
Author
Owner

@sboulema commented on GitHub (May 1, 2020):

Thanks for the quick response!

Those parameters are added as query parameters though. I am looking for adding a parameter as part of the url path.

/petstore/pet/:petId

With a parameter petId defined as 42 for example.

Would lead to: /petstore/pet/42 as url.

The current parameters would give me:

/petstore/pet?petId=42 as url.

<!-- gh-comment-id:622344317 --> @sboulema commented on GitHub (May 1, 2020): Thanks for the quick response! Those parameters are added as query parameters though. I am looking for adding a parameter as part of the url path. /petstore/pet/:petId With a parameter petId defined as 42 for example. Would lead to: /petstore/pet/42 as url. The current parameters would give me: /petstore/pet?petId=42 as url.
Author
Owner

@liyasthomas commented on GitHub (May 1, 2020):

Yep, that's why we've Pre-request scripts which can be use to set environment variable. Check Environments Tab in right sidebar to add/export/import envs.

Read more on Pre-request scripts: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-Scripts

We use <<>> angle-braces (instead of {{}} in Postman) to represent env variables.

image

<!-- gh-comment-id:622345496 --> @liyasthomas commented on GitHub (May 1, 2020): Yep, that's why we've `Pre-request scripts` which can be use to set environment variable. Check Environments Tab in right sidebar to add/export/import envs. Read more on `Pre-request scripts`: https://github.com/liyasthomas/postwoman/wiki/Pre-Request-Scripts We use `<<>>` angle-braces (instead of `{{}}` in Postman) to represent env variables. ![image](https://user-images.githubusercontent.com/10395817/80801120-0b26c900-8bc9-11ea-8114-1df1e69bc36f.png)
Author
Owner

@sboulema commented on GitHub (May 1, 2020):

Ah, missed that! Thank you very much 😃

<!-- gh-comment-id:622346269 --> @sboulema commented on GitHub (May 1, 2020): Ah, missed that! Thank you very much 😃
Author
Owner

@liyasthomas commented on GitHub (May 1, 2020):

Disclaimer: I'm too busy living my life I fairly have no enough time to improve the Environment flow. 😄

There'll be bugs. Let me know if you stumbled upon any bugs.

<!-- gh-comment-id:622346996 --> @liyasthomas commented on GitHub (May 1, 2020): Disclaimer: I'm too busy living my life I fairly have no enough time to improve the Environment flow. 😄 There'll be bugs. Let me know if you stumbled upon any bugs.
Author
Owner

@sboulema commented on GitHub (May 1, 2020):

Have a problem I am running into...

I set my petId as an env variable using the prerequest script. But now I can't select an env from the list to set other variables cause it would overwrite my request specific env variable.

Production environment:
<<PetstoreHost>>

Request env variable:
<<PetId>>

So either I end up with an environment with all path variables for all endpoints, or an environment foreach endpoint...

Would be nice if the environment appends to the prerequest script instead of overwrite if there are request specific variables. Or the request variables should be saved/configured elsewhere?

Thanks for all the hard work and real life is way more important!

<!-- gh-comment-id:622358580 --> @sboulema commented on GitHub (May 1, 2020): Have a problem I am running into... I set my petId as an env variable using the prerequest script. But now I can't select an env from the list to set other variables cause it would overwrite my request specific env variable. Production environment: `<<PetstoreHost>>` Request env variable: `<<PetId>>` So either I end up with an environment with all path variables for all endpoints, or an environment foreach endpoint... Would be nice if the environment appends to the prerequest script instead of overwrite if there are request specific variables. Or the request variables should be saved/configured elsewhere? Thanks for all the hard work and real life is way more important!
Author
Owner

@liyasthomas commented on GitHub (May 1, 2020):

Do you believe overwriting current env should be the default action? It's easily possible to append vars to current env - but I suspect everybody should not be expecting that behaviour.
An environment with all path variables for all endpoints would be my choice. Anyways, I'm all ears, open for suggestions.

<!-- gh-comment-id:622435154 --> @liyasthomas commented on GitHub (May 1, 2020): Do you believe overwriting current env should be the default action? It's easily possible to append vars to current env - but I suspect everybody should not be expecting that behaviour. An environment with all path variables for all endpoints would be my choice. Anyways, I'm all ears, open for suggestions.
Author
Owner

@sboulema commented on GitHub (May 2, 2020):

That was a fun saturday!

I wrote a possible solution to the problem: github.com/sboulema/postwoman@25f014ef3b

PathParameter

It adds a type dropdown to the current parameter list. Based on the type, the parameter either gets included as a query parameter or gets added as an environment variable so it can be used in the current url path template replacement.
Parameters without a type are treated as query parameters so the implementation is backwards-compatible.

This way the parameter gets saved with the request and does not have to be saved with the environment.

Any thoughts or comments ?

If you want I can submit a PR 👍

<!-- gh-comment-id:622989845 --> @sboulema commented on GitHub (May 2, 2020): That was a fun saturday! I wrote a possible solution to the problem: https://github.com/sboulema/postwoman/commit/25f014ef3b34216068193bad5b2e899cea39fda2 [![PathParameter](https://i.imgur.com/teJ3MiD.png)](https://i.imgur.com/teJ3MiD.png) It adds a type dropdown to the current parameter list. Based on the type, the parameter either gets included as a query parameter or gets added as an environment variable so it can be used in the current url path template replacement. Parameters without a type are treated as query parameters so the implementation is backwards-compatible. This way the parameter gets saved with the request and does not have to be saved with the environment. Any thoughts or comments ? If you want I can submit a PR 👍
Author
Owner

@liyasthomas commented on GitHub (May 3, 2020):

@sboulema implementation looks good to me. shoot the PR 🚀

<!-- gh-comment-id:623034336 --> @liyasthomas commented on GitHub (May 3, 2020): @sboulema implementation looks good to me. shoot the PR 🚀
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#293
No description provided.