Chris-L
Novice

How to dynamically set host for REST Service / SmartObject

When setting up the REST service you use a swagger file that contains the host name, but how do you set the host name based on, e.g. an environment variable or a variable in your workflow? It seems like it would be a common requirement if you are hitting custom in-house API end-points and you have different hosts for your test vs production (that's our use-case). Are we stuck with having to have to manually create different swagger files and services for each environment? 

Labels: (1)
0 Kudos
Reply
2 Replies
khanh
Nintex Employee
Nintex Employee

Re: How to dynamically set host for REST Service / SmartObject

Hi Chris-L,

 

It sounds like you want dynamic hostname in the Swagger file or have a K2 environment field that will handle it. I'm not quite sure if this is some thing that can be done in the product. According to the link below, the base url must have an actual host name, I suspect the K2 REST service will throw a validation message it's not an actual value.

https://swagger.io/docs/specification/2-0/api-host-and-base-path/

 

0 Kudos
Reply
paulk
Scout

Re: How to dynamically set host for REST Service / SmartObject

Yeah you need to do this, unless you could somehow have a dynamic json file server up a different host based upon the k2 server connecting to it, but that sounds very complicated and would need an endpoint that all of your K2 servers could see.

 

I automated this away by having some PowerShell to spit them out for me for each target environment.

 

Cheers

0 Kudos
Reply