Redirecting to a screen from exposed Rest API
Question
Application Type
Reactive
Service Studio Version
11.12.0 (Build 48966)

Hi, 

I have exposed an Rest API for other system to consume in services module. In that API I have used HTTP request handler actions(SetStatusCode -302 and AddHeader- as "Location" which is set as Screen URL present on another module which is a Front end application) to get the data coming from exposed API on initializing event of a screen URL which I mentioned above. For some reason that redirection is not happening. Can anyone help me why...It's not happening. 


Thanks in advance. 

Venkatesh S

Hi Venkatesh,

Could you share your example .oml compare your flow? I also put a redirect in my REST API, it looks to work both GET and POST methods. There should be a rule about the usage of Location header but I need to check it first.


Sincerely,
Necmettin

RESTRedirectTest.oml

Hi Necmettin,

Thanks for your response!

I checked your OML which is redirecting to an external website not the screen of our OutSystems environment. The usecase which was implemented in the OML shared is working from my end also.

The problem what I am facing is, I am unable to redirect to the "OutSystems Screen". I have attached the OAP file which includes(ServiceActionsTesting - ReactiveModule which is having the screen, RedirectServiceModule - we have an exposed API, here this API should call the screen present on the other module).

When I am testing the API I am getting "JavaScript is required!" error on Postman tool. 

Again thanks for your valuable time!

Thanks,

Venkatesh S

RedirectExposedAPI.oap

Hi,

It is an expected result that you see "Javascript is required" warning when you test it in Postman because Javascript doesn't work on Postman and Outsystems reactive web app requires Javascript. However, your redirection is working actually. So, you redirected the user to the correct page successfully. You should see the HTML source code in the pretty or raw tab in the response as looking as below. 


I would like to help you more if there are still issues in your case. 

Please also let me know your aim for this kind of redirection.

Sincerely,
Necmettin

Hi Necmettin,

Thanks for your help, I understood the flow now. My aim is to read the data coming from the API we exposed and insert it into the table to auto fill the next screen with the data we got.


Thanks,

Venkatesh S

API is designed to make communication between machines. If you would like to create a flow with user interaction, you should make it with Web screens that work in the browser. A Web screen is able to handle POST and GET methods as well as REST API. You can change your perspective to get your aim. 


Best regards,
Necmettin

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.