Lifetime Environment 405 Method Not Allowed when Calling External API using POST
Application Type
Traditional Web
Service Studio Version
11.6.1 (Build 3699)

We moved an application from the paid environment to the lifetime environment. This application worked without issue in the paid environment. In the lifetime environment all the API gets work, but anything API that does a POST fails with 405 Method not allowed. These API were written by our development team and work in Swagger and Postman.  

We found the issue the API calls were using HTTP. This use to work. 

We updated the all API calls to use HTTPS and all call work now. 

We were able to recreate the issue with Postman and that pointed us to the solution.

Ah! The HTTP vs HTTPS issue!


Glad you could solve that mystery. And thanks for updating the thread :)

Hey Ralph,

405 Method No Allowed means that you are not using the correct HTTP Method with that endpoint. For this specific case I'd say that the endpoints you are consuming do not accept the POST method.


Since it seems this works with Postman and the team moved the application it could happen that some of URL paths were changed mistakenly or the move triggered that. My advice would be to use Service Center to check if the endpoints and URL paths have the correct value in the Effective Value input.

Thanks for the response. If I am looking in the correct place the URL looks correct. 

 

Also all the get calls are working correctly. 

If you enter the detail of that Consumed API is the effective url value correct as well (or empty)?

Also do you have the documentation of that API? In the documentation it should be clear what endpoints accept what HTTP methods. So you should be able to see that for the endpoints that you are having that error it only accepts the GET method, for example.

The 405 error is pretty straightforward so there should be a tiny little detail here that is being overlooked.

I don’t see why moving the code could do this but just in case it’s because of that, can you try consuming that API in another OutSystems environment (that is not the lifetime one)

Sorry I have gotten back to you sooner, I have been reviewing code and talk with the developer of the app and review the server logs. Still no answer.  According to the code we using a POST.



Did you had the chance to try consuming this API in another environment?

With this level of detail it's hard to help you further... What I would do if faced with this problem:

  1. Open the APIs documentation. If it's built with OutSystems you can easily check the documentation by using the full URL of the API in a browser. For example, I have an API built in my testing environment and if I want to consume it I have to paste this URL in Service Studio: https://<my-environment>.outsystemscloud.com/Product_API/rest/v1/ - if I paste in the browser I'm redirected to the APIs documentation.
  2. As you can see the /categories URL path only accepts the GET method. If I try calling that 
  3.  But if I try with a POST


With all that said, I'd recommend:

  1. checking the documentation alongside with the development team, and the endpoints you are calling support the POST method
  2. implementing a different API (just for testing) with a method that is using the POST method and consume it
  3. consuming the API in a different environment that you are using


If all that fails, I can only see two options:

  1. You are really referring to the Lifetime environment and because of that, it might have some configuration that does not allow for this type of API usage (I'm not aware of anything like that, but it might be the case)
  2. Open a Support ticket with OutSystems Support

Thank you for the your help. I have not tried the API in another environment because we didn't renew our contract for a few reasons. I do think OutSystems is one of the better low code solutions. What I can tell you is that ever Post or Delete method we use in our application fails with a 405 error. Our app uses APIs for all CRUD and business logic operations. I will work on this in the coming weeks. I can still demo the system since all Get operations work and we have scripts that run on a daily bases that keep the data fresh.   

Let me know if I can help you further, and if you want provide me more details via direct message.

We found the issue the API calls were using HTTP. This use to work. 

We updated the all API calls to use HTTPS and all call work now. 

We were able to recreate the issue with Postman and that pointed us to the solution.

Ah! The HTTP vs HTTPS issue!


Glad you could solve that mystery. And thanks for updating the thread :)

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