Skip to content

Commit 9cbea2f

Browse files
authored
Create README.md
dynamic outbound endpoints
1 parent 6a63cda commit 9cbea2f

File tree

1 file changed

+27
-0
lines changed
  • Integration/RESTMessageV2/DynamicOutboundEnpoints

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
This is a server-side Script Include that contains the core logic. It reads the endpoint configurations from a System Property, parses the JSON, and returns the appropriate URL based on the current instance's name.
2+
3+
System Property: x_my_scope.api.endpoints
4+
This property stores a JSON object containing the endpoint URLs for each environment. It must be created and populated in each instance that uses the utility.
5+
6+
Sample JSON object:
7+
{
8+
"dev": "https://dev-instance.example.com/api",
9+
"test": "https://test-instance.example.com/api",
10+
"prod": "https://prod-instance.example.com/api"
11+
}
12+
13+
Usage:
14+
var endpointConfig = new EndpointConfig();
15+
var endpointUrl = endpointConfig.getEndpoint();
16+
if (endpointUrl)
17+
{
18+
gs.info("Endpoint URL: " + endpointUrl);
19+
//Use the endpointUrl in your REST call
20+
var request = new sn_ws.RESTMessageV2();
21+
request.setEndpoint(endpointUrl);
22+
// ... rest of your integration logic
23+
} else
24+
{
25+
gs.error("Failed to retrieve endpoint URL.");
26+
}
27+

0 commit comments

Comments
 (0)