Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Method FormatUrl with Api Gateway

Open douglasbcosta opened this issue 4 years ago • 0 comments
trafficstars

Here I have an API Gateway before access salesforce, wich makes a query calling something like {baseUrl}/{path}/services/data/... I found that if I try to set the InstanceUrl like {baseUrl}/{path} it wont work because of method FormatUrl called in ForceClient wont get the path. The final url will just be {baseUrl}/services/data/... without the path of Api Gateway. I had to inhite a new class from IForceClient to substitute just this method.

Instead of using the Common class I wrote a similar method that instead of returning: new Uri(new Uri(instanceUrl), string.Format("/services/data/{0}/{1}", apiVersion, resourceName)); I return new Uri("{0}/services/data/{1}/{2}", instanceUrl, apiVersion, resourceName);

The same for the other url formats. As I dont use much other endpoints I dont know the impacts of that in other cases or if it would have an easier way to solve.

douglasbcosta avatar May 14 '21 16:05 douglasbcosta