OL Learn

Dynamic HTTP Actions

Hi,

Can the HTTP Actions in the NodeJS Server Input be dynamic or contain a wild card?

I need to create an http action per shop just because each shop will have its own separate logo and personalised information. I would like the login page to display the logo for the corresponding shop.

So for instance if http://ipaddress:9090/shopname is the url, depending on the shopname value, I would then present the user with a login page with logo and other details applying to that specific shop.

I figure I could enter each shop name individidually in the NodeJS Server Input HTTP Actions, but there is a list of 35 shops and there could be more in future.

Is there anyway to make the HTTP action dynamic with the use of a variable or regex?

You can’t make it as dynamic as you suggested, but you can achieve the same results by creating a generic action and then using a simple condition to determine the shopname.

For instance, your action could be:
http://ipaddress:9090/shop

Customer 1 could then log on using
http://ipaddress:9090/shop/customer1

while Customer 2 would log on using
http://ipaddress:9090/shop/customer2

In your Workflow process, immediately after the NodeJS Input task, you would add a Set Job Infos and Variables task that captures the name of the customer from the request file (it is stored in the <sub1> element) and stores it in a process variable which you can then use throughout your process to distinguish each customer:

1 Like

I like your answer and it is very clear. Thank you Phil. I will give it a go.

As a side note, if you plan on having several different customers log on to your web site, you should really consider using HTTPS as the protocol. You can set that in the NodeJS Server Input 1 preferences.