How to build dynamic Target Endpoints

I have below target endpoints in my proxies. One is of our backend test environment and other of prod as below.

TEST

https://wd-impl-services1.abc.com/ccx/service/customreport2/TEST/ISU_INT555/CR_INT123_User_Profile_and_About_Me?Organization_Reference_ID=BU_ALL

PROD

https://wd-prod-services1.abc.com/ccx/service/customreport2/PROD/ISU_INT555/CR_INT123_User_Profile_and_About_Me?Organization_Reference_ID=BU_ALL

If you see except the host and instance all other part of URL is same.

How can I dynamicaly build this URL's in Apigee proxy. In apigee test instance I want to call TEST URL and in Prod I want to call PROD URL.

What is the way to achieve this ? Can it be done using Target Server functionality of Apigee ?

Solved Solved
0 3 1,121
1 ACCEPTED SOLUTION

Not applicable

Yes, you can achieve this using TargetServer and using other ways as well.

I would suggest to do using Target server.

create a targetserver named xyz, then configure

wd-impl-services1.abc.com in TEST

and

wd-prod-services1.abc.com in PROD


Then in the path tag

<Path>/ccx/service/customreport2/{environment.name}/ISU_INT555/CR_INT123_User_Profile_and_About_Me</Path>


environment.name this will resolve to PROD in PROD environment and TEST in TEST environment.

View solution in original post

3 REPLIES 3

Not applicable

Yes, you can achieve this using TargetServer and using other ways as well.

I would suggest to do using Target server.

create a targetserver named xyz, then configure

wd-impl-services1.abc.com in TEST

and

wd-prod-services1.abc.com in PROD


Then in the path tag

<Path>/ccx/service/customreport2/{environment.name}/ISU_INT555/CR_INT123_User_Profile_and_About_Me</Path>


environment.name this will resolve to PROD in PROD environment and TEST in TEST environment.

If I am not wrong then environment.name will resolve to name of apigee instance and not the backend instance of the my target endpoint. Isn’t it ?

This will resolve to Apigee environment name. If your environment name is different then just set another variable as per condition in a javascript.