Hello All,

I am trying to call REST API on timer but its giving me an error 403: forbidden 

But when I am using same rest API call on click of button, it is working fine.

I am not getting what I am missing.

Thanks

Prajakta Roshankhede

The 403 Forbidden error is from the server your sending your request to. So your timer is working perfectly. Are you sure you are using the same code to call the API? Perhaps you are overflooding the API with the timer and this is causing the 403 notification as a flood protection?


edit: typo

Hi Prajakta,

I have a couple of questions first.

  • Are we talking Cloud or On-Premise?
  • Does the environment where you have this issue exists of one or more servers? 
  • Are there any network limitations to these servers (Public access)?
  • Does the REST API exist in an OutSystems environment or is it a public one?

Please help us understand the case better.

Regards,

Nordin

Prajakta, 

I will risk saying this is a problem of authentication.

Remember that a Timer runs in its own section (user-independent).
This means that if you rely on the user credentials to call the REST service, it will work when the user is logged and click the button the triggers the request, but when the timer runs, there is no user logged in. So, if you need its credentials, the request to the REST API will fail.

But can be other things as well.

Cheers.

Solution

Hello All,

Thanks for your quick responses and sorry for replying late.

This issue is solved, there may be change in both calls. As I was consuming rest api differently in diffeent module for button click action and for timer. I just copied the one which I was using for button click action and it is working fine for me now.

There must be some input parameter data type change.


Thanks again!

Solution

Hi Prajakta,

To prevent these type of problems you should always try to reuse your code as much as possible. Calling the API should never be inside a screen action but always inside a server action. This way you could have used the same code in your screen action and in your timer action and not have encountered this issue.

Kind regards,

Vincent Koning