Hi,I want to integrate 2 REST API with the Mobile application, where the one is for Login & another to GetData.API Detail:Login API : Method - POST , Request Body : Username & PasswordGetData API :Method - GET------------------------------------------------------------------------API behavior on Postman : The second API GetData works only when I am logged-in via the Login API.In-case If I am not logged-in , the second API will return access denied.API behavior with Visual Studio C# : I confirmed the instance case with C# by creating 2 different instance of the HttpClient class & calling the GetData API respectively. But here only the instance worked from which I initially hit the Login API, same as Postman.------------------------------------------------------------------------How can I maintain or re-use the same instance of the HttpClient class in Outsystems to call the GetData API.Thanks,Assif
Resolved :)
Created an Extension & then I am calling the respective API from this Extension.
Hi Assif,
Do you have documentation for this REST API? Although I understand what you ask, I don't think that's the solution to this problem.
Hi,
Please ref the below screenshots:
1- Request with same HttpClient Object Working Fine : C# Snippet Sample
2- Request with different HttpClient Object Not Working : C# Snippet Sample
Same behavior occurred with Outsystems, as I am consuming both REST API separately & thus I am calling the API action individually. The Second API GetData works on same Http Object Request, from which the Login API is called Initially.
Thanks
HI Assif,
What you're seeing is the result of how the REST API is implemented, but that doesn't mean it's the only way that this can be solved. Therefore, again, please direct us to the API specification. Unless it says "you need the same HttpClient" (in which case they're raving mad), it's very likely it can be solved differently (also not that REST calls should by definition be stateless, so if it worked like you say, it would violate REST principles as well).
Kilian Hekhuis wrote:
Thanks Kilian for quick response,
Here is the postman snapshot for ref:
1- Login API :
2- GetData API :
That's still not an API description. I meant the documentation for it. If that's not public, there's little I can do to help.