Change part of URL for all endpoints

Hello.

Is it possible to change part of URL of any endpoints? How I can do it?

For example I put site URL to var and now I need change it at all endpoints.

Thanks.

This type of activity is covered in the Postman Learning Centre.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

Overview | Postman Learning Center

Including the Postman Training links under “Other Resources”.

image

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes using variables.

I think either I phrased my question incorrectly or you misunderstood my question. I will try again.

I have a collection, in the collection there are endpoints. In each endpoint I have a URL like https://site.com/api/<method>/?<params>. I need to replace https://site.com with a variable in all endpoints. To avoid having to do this manually, I thought maybe there was a way. I looked at the API and found nothing except: https://www.postman.com/postman/workspace/postman-public-workspace/folder/12959542-acbe573f-3abb-453c-a2b8-124213d069ab, but there is no way to update collection elements, that’s why I created the ticket here.

Is it clearer now? Or does your answer just solve my problem?

Thanks.

If you want to update the details in a collection, you can use the Postman Collection API which will return a JSON representation of your collection.

Get a collection | Postman Public Workspace | Postman API Network

That API has methods for patch requests.

Update part of a collection | Postman Public Workspace | Postman API Network

The following link may be of use as well.

Structure of a collection | Postman Collection Format

@michaelderekjones

Thanks a lot for your help!

@satellite-cosmolog11

Thanks for your answer, but this is not at all what I need.

In general, my problem is solved as follows:

  1. I get the entire collection using the API - https://api.getpostman.com/collections/{{collectionId}}.
  2. I replace the necessary part in all endpoints.
  3. I send updated data using the API - https://api.getpostman.com/collections/{{collectionId}}.

I get profit)

Thanks.

1 Like

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