85
Views
8
Comments
Solved
REST with variable port number
Question

I have a REST POST command I need to do where it is the format https://myurl.com:1234/something.  However, we want to have both the "1234" and the "something" be input variables.  So at one point we might want to do myurl.com:4322/bird and another time post myurl.com:1111/cow.  So what I would like to do is have the post set up as https://myurl.com:{Port}/{Text} and port and text are both input variables.  But it seems like it will not let you have a variable before the first "/".  Any suggestions?

2016-04-21 20-09-55
J.
 
MVP
Solution

why would you change ports runtime?

(it can be configured via servicecenter, btw, so it's not that hardcoded)


you can also change it via OnBeforeRequest

2017-08-09 12-12-29
Jason Herrington

J. wrote:

why would you change ports runtime?

(it can be configured via servicecenter, btw, so it's not that hardcoded)


you can also change it via OnBeforeRequest

The url/port number is the url/port on the other computer that I am sending the post to.  It looks to me like they are using different ports for different things and we may want to dynamically change that at run time and I didn't want to have to make X number of REST items for each port number they may want to send to.

If I understand your response correctly, I am not wanting to change any port numbers on my OutSystems server, I am wanting to dynamically change what port number the REST is communicating to on the receiving server outside of my control.

2016-04-21 20-09-55
J.
 
MVP

J. wrote:

you can also change it via OnBeforeRequest

*cough* :P



2017-08-09 12-12-29
Jason Herrington

J. wrote:

J. wrote:

you can also change it via OnBeforeRequest

*cough* :P



J. sorry!  Just saw that.  Marked yours as the solution as you said it first.


2016-04-21 20-09-55
J.
 
MVP

change the baseUrl to https://myurl.com:1234/something

2017-08-09 12-12-29
Jason Herrington

yes, but then that makes 1234 and something hard coded.  I want to have it such that the 1234 and the something are based on input variables.

2016-04-21 20-09-55
J.
 
MVP
Solution

why would you change ports runtime?

(it can be configured via servicecenter, btw, so it's not that hardcoded)


you can also change it via OnBeforeRequest

2017-08-09 12-12-29
Jason Herrington

J. wrote:

why would you change ports runtime?

(it can be configured via servicecenter, btw, so it's not that hardcoded)


you can also change it via OnBeforeRequest

The url/port number is the url/port on the other computer that I am sending the post to.  It looks to me like they are using different ports for different things and we may want to dynamically change that at run time and I didn't want to have to make X number of REST items for each port number they may want to send to.

If I understand your response correctly, I am not wanting to change any port numbers on my OutSystems server, I am wanting to dynamically change what port number the REST is communicating to on the receiving server outside of my control.

2016-04-21 20-09-55
J.
 
MVP

J. wrote:

you can also change it via OnBeforeRequest

*cough* :P



2017-08-09 12-12-29
Jason Herrington

J. wrote:

J. wrote:

you can also change it via OnBeforeRequest

*cough* :P



J. sorry!  Just saw that.  Marked yours as the solution as you said it first.


2012-03-16 12-21-09
João Rosado
Staff

HI Jason,


You can do that with an OnBeforeRequest action to change the base url dinamically in runtime.


Regards,
João Rosado

2017-08-09 12-12-29
Jason Herrington

Ah ok!  Thank you.  That will do it.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.