# Update hostname and port before real request

**URL:** <https://community.postman.com/t/update-hostname-and-port-before-real-request/70927>\
**Category:** Help Hub\
**Tags:** tests, pre-request, pre-request-script\
**Created:** [November 7, 2024, 7:28am UTC](https://community.postman.com/t/update-hostname-and-port-before-real-request/70927 "2024-11-07T07:28:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aerospace-geoscient4](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@aerospace-geoscient4](https://community.postman.com/u/aerospace-geoscient4)\
**Post date:** [November 7, 2024, 7:28am UTC](https://community.postman.com/t/update-hostname-and-port-before-real-request/70927/1 "2024-11-07T07:28:12Z")

</div>

Now, many companies use microservices to manage their applications. Each microservice may exist in multiple environments. They use the registry to register these services, such as eureka, console, etcd, etc.  
I hope to use such URL addresses to request these services  
[http://system-user-service/path-to-get-data](http://system-user-service/path-to-get-data)  
This requires using pre-script to obtain the system-user-service string in the URL, and then go to the registry to query the correct port number and IP, such as  
192.168.1.100 8080  
Then replace it with the correct port of the service before the formal request. The final request is as follows  
[http://192.168.1.100:8080/path-to-get-data](http://192.168.1.100:8080/path-to-get-data)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [November 7, 2024, 9:00am UTC](https://community.postman.com/t/update-hostname-and-port-before-real-request/70927/2 "2024-11-07T09:00:01Z")

</div>

Hey 👋🏻

Welcome to the Postman Community :postman:

I’m not sure that there is a question here - Could you provide more information and context about what it is you’re trying to do / having trouble doing in Postman, please?

Are you trying to get some data from the response of that URL and then use this in another request?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [December 7, 2024, 9:00am UTC](https://community.postman.com/t/update-hostname-and-port-before-real-request/70927/3 "2024-12-07T09:00:45Z")

</div>

Closed on December 7, 2024, 9:00am UTC

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