Skip to main content

K2 4.7

 

We setup a smartobject to integrate with a REST endpoint (e.g https://api-qa.company.com/v1/api/account/1234) using a JSON Swagger/Open API definition using steps similar to the ones listed here

 

Everything works fine in QA/UAt and we would like to deploy this into Production. But the REST endpoints are hard-wired to point to the QA server. We can setup a new Smartobject pointing to Production but that seems sub-optimal. Instead, is there a way to have some sort of environment variable/string table entry that determines which server to point to (api.company.com instead of api-qa.company.com in this example)

 

Any ideas appreciated. Thanks

Each service endpoint instance across your K2 enviornments can be configured independently - as long as they have the same guid between environments you can have one point to QA and one point to PROD and your smart objects will not need to change. My recommendation would be to let the package and deployment wizard do this work for you - the first time you deploy this smart object to prod, it will identify that it needs this REST service instance it it will appear in the package and deployment wizard - you can configure it there to point to prod.

 

I'm making some assumptions here on how you are doing this as the link provided isn't bringing anything up, but hopefully this is close to what you are trying to accomplish.


The link was just an example to demonstrate a typical REST API endpoint, the second link in my original post points to a blog post that describes the technique I used. Here is another one

 

you can configure it there to point to prod.

 

Right, I am not sure  how I can point to Prod.  When I register the service instance in the Smart Object tester, I provide a Swagger/Open API JSON file that describes everything about the REST API endpoint e.g. Hostname, methods, datatypes, parameters, etc. In QA, I want the host to point to, say, api-qa.company.com while in Prod I want it to point to api.company.com. How can I do this?

 

Am I missing something?


So you register the instance on QA, and there you specify the QA host. When you register this instance on PROD (or let the package and deploy wizard do it), you specify PROD as the host. Therefore, when you invoke a smartobject on QA, it talks to the QA endpoint and flows through the QA host you defined there. That same SmartObject on PROD will talk to the PROD endpoint and flow through the PROD host you defined there.


Reply