Connect to dynamic URL within OData in SAP project

You can try and create a URL in your code which you can read from config or XML.

Here is a sample code snippet −

String uri = // Can read from config or anywhere
string odQuery = "?$format=json"
var req = WebRequest.Create(uri+"/"+ odQuery);
req.Method = "GET";
var streamreader = new StreamReader(stream: request.GetResponse().GetResponseStream());
string response = streamreader.ReadToEnd(); //json response

This is a sample code snippet but you can modify it as per your use case.