Skip to Content
author's profile photo Former Member
Former Member

Using POST Method in REST client

Hi,

I am trying to integrate SAP Cloud solution with hybris. In SAP Cloud studio, the PUT method doesn't seem to be supporting. Hence, I am forced to use POST. However, in the REST Client, I tried using the POST Method and I get the error "HTTP/1.1 405 Method Not Allowed". Please confirm if hybris doesn't allow POST method calls.

URL: http://XXX.XXXXXX.com/ws410/rest/catalogs/powertoolsProductCatalog/catalogversions/Online/products/2116275

Body:

KC370

Method: POST.. It works fine with PUT. But, I have to use POST. Please can you help?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 24, 2015 at 03:59 PM

    Hi Hariprasauth,

    I just tested locally in another controller and here the POST method is allowed. I couldn't find your method, but I tested this in Hybris version 5.2.0.4. And both methods logged the output in the log file.

         @RequestMapping(value = "/available", method = RequestMethod.POST)
         @ResponseBody
         public void testPost()
         {
             Logger.getLogger(TestController.class).info("Post method!");
         }
         
         @RequestMapping(value = "/available", method = RequestMethod.PUT)
         @ResponseBody
         public void testPut()
         {
             Logger.getLogger(TestController.class).info("Put method!");
         }
    
    

    Are you sure the RequestMapping method is RequestMethod.POST?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 05, 2015 at 02:35 PM

    Hi Danny,

    Thanks for the response. Yes. I had to manually enable the POST method in the products resource JAVA class. However, there are certain other resources like Stock where I couldnt manually do it as they are generated.

    Any leads on this, please?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.