Change dynamically REST API URL

Change dynamically REST API URL

  
Hi everyone!

I have an issue regarding a REST API integration.

1st of all we call a method to get an Authorization Token and an end point URL. No problem!

2nd This service specifically uses some kind of load balancer and will return the URL where we should do next requests with Authorization Token. And now we have a problem! We can only do that on service center... :(

Do you guys know any way of changing dynamically the URL of the REST API?

Something like Extension EnhancedWebReferences - Method SetWebReferenceURL

Thanks
Hi Andre,

I've never done it, but I think you can do stuff in the OnBeforeRequest, especially the advanced one. You can find more info here.
Just a quick note on Killian answer.

The url can only be set in the OnBeforeRequest. The url is pretty much the only thing that cannot be changed in the OnBeforeRequestAdvanced since the C#/Java correspondent Request objects are already created at that point and the url is readonly in them.

Regards,
João Rosado
Ok, I stand corrected. Thanks!
Solved! :)



Thanks
Hi!

I have an additional question (also made a post here)

At the moment I use the OnBeforeRequestAdvanced event to call an extention to add NTLM authentication to the request. But because it is a shared component between several applications we have different endpoints en we also want to change the baseURL. But this is not possible in the advanced event.

Is there a solution for this problem?