Skip to content

Commit d335de5

Browse files
authored
Create README.md
1 parent 2903437 commit d335de5

File tree

1 file changed

+26
-0
lines changed
  • Integration/OutboundRestDynamicEndpoint

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
gs.error("Failed to retrieve endpoint URL.");
25+
}
26+

0 commit comments

Comments
 (0)