Unable to consume REST API due to swagger error

Hi,

In my project, I was consuming various REST apis and everything was working fine since last day. But all sudden am not able to consume any API and getting below error.


According to above error statement, I have republished System components solution from Service Center-> Factory -> Solutions -> Systems Components solution. But still error is same.


Also, when I click on Test button in API method I got one error in service center :

HTTPS connection required.
   at OutSystems.RESTService.Controllers.RestServiceApiController.ValidateRequestSecurity()
   at OutSystems.RESTService.Filters.OnRequestFilter.OnAuthorization(HttpActionContext actionContext)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.OnAuthorizationAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()


One more point, what difference I can see in environment is that some one has enabled HTTPS for this environment. For other environments where these HTTPS are off everything working fine.

Please help me to find out the issue.

Thank you,

Regards

Vikas

Hi Vilas,

The error message indicates you do not have permission to access the endpoint. 

403 error response indicates that the client's request is formed correctly, but the REST API refuses to honor it. A 403 response is not a case of insufficient client credentials; that would be 401 (“Unauthorized”). ... For example, a client may be authorized to interact with some, but not all of a REST API's resources.

Regards,

Daniel

Hi Daniel,

Thanks for reply. But till yesterday I was able to access all those apis. There are many apis like Google, sms, payment and am not able to access any one. 

Also, when I click on Test button in API method I got one error in service center :

HTTPS connection required.
   at OutSystems.RESTService.Controllers.RestServiceApiController.ValidateRequestSecurity()
   at OutSystems.RESTService.Filters.OnRequestFilter.OnAuthorization(HttpActionContext actionContext)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.OnAuthorizationAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()


One more point, what difference I can see in environment is that some one has enabled HTTPS for this environment. For other environments where these HTTPS are off everything working fine.

Hi,

It would haved help if you give all that extra information in your original post. 

I think you need to check the effective URL in service center for the REST services to also use https!//. You can do this on the modules integration tab in Service Center.

When you want to use the Test button on an API method in service Studio you also need to ensure the URL starts with https://.

Regards,

Daniel


Daniël Kuhlmann wrote:

Hi,

It would haved help if you give all that extra information in your original post. 

I think you need to check the effective URL in service center for the REST services to also use https!//. You can do this on the modules integration tab in Service Center.

When you want to use the Test button on an API method in service Studio you also need to ensure the URL starts with https://.

Regards,

Daniel


Hi Daniel,

I have updated original post. As per your suggestion am already using https:// while testing API.

Also in service center I checked for module integrations tab. There also using https://

Please suggest.

The error message is related to the OutSystems environment not the rest services as shown in your last post.

It is difficult to help as on every post you give some new piece of information.thr first.post had the environment name in the error rubbed out.