Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

405 method not allowed #11613

Closed
1 task done
ghost opened this issue Jan 11, 2023 · 4 comments
Closed
1 task done

405 method not allowed #11613

ghost opened this issue Jan 11, 2023 · 4 comments
Assignees
Labels
staff/done support How do I ... ? Can I ... ?

Comments

@ghost
Copy link

ghost commented Jan 11, 2023

Is there an existing issue for this?

  • I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

Hello, I create my very first collection based on Swagger PetStore documentation. And I have proplem with methods POST DELETE and PUT. When I send as reqest correct body with JSON format (raw), with headers CONTENT_TYPE application/JSON in response i have status code :405 method not allowed. and in Content-type application/xml. Please help me :) It's my first collection and I really don't have idea what's going on....
In Swagger documentation this reqest work correctly.
mistake
mistake2

Steps To Reproduce

  1. Used Swagger Petstore documentation and create any reqest with method POST where needs body in aw format with JSON.

Screenshots or Videos

mistake
mistake2

Operating System

Postman for Windows

Postman Version

Version 10.7.1 UI Version 10.7.1-ui-230107-1501 Desktop Platform Version 10.7.0 Architecture x64 OS Platform win32 10.0.19045

Postman Platform

Other

User Account Type

Signed In User

Additional Context?

No response

@xk0der xk0der added support How do I ... ? Can I ... ? staff/pending labels Jan 11, 2023
@postman-staff postman-staff self-assigned this Jan 11, 2023
@postman-staff
Copy link
Collaborator

Hello kulak-daria**,**

The “405 Method Not Allowed” error occurs when the server is configured in a way that does not allow you to perform a specific action for a particular endpoint (URL). It's an HTTP response status code that indicates that the request method is known by the server but is not supported by the target resource (your request URL).

There are multiple causes for this error, but most commonly, this is caused by the server (endpoint URL) configuration.

  1. Firstly, You want to confirm which methods are supported for each endpoint and ensure that the POST method is configured. Ensure that your baseURL variable associated with your POST method is point to https://petstore3.swagger.io/api/v3
    (as highlighted in my screenshot below, as I was unable to reproduce this issue)

  2. Secondly, you want to confirm the then request URL is written correctly for the POST request (confirm it has no trailing spaces for example).

  3. Lastly, test if your POST request succeeds outside Postman; Send a request using cURL in your terminal. To do this, copy the cURL code generated by your request, paste it into your terminal, and send the request.

I have also referenced a discussion about this response in our Community: https://community.postman.com/t/405-method-not-allowed/16743/3 which has some additional troubleshooting steps you may try.

I hope that this information is helpful, and I have included an export of my working collection based on Swagger PetStore documentation - should you wish to test the POST method to "Add a new pet to the store"

via @loutsiros | Postman Support

@loutsiros
Copy link

@ghost
Copy link
Author

ghost commented Jan 12, 2023

Thank You! I changed base URL in my POST METHOD request and it WORKS! :)

@Rahulrokkz666
Copy link

You can also check out this comprehensive guide on "How to Fix the “405 Method not Allowed” Error. (8 methods)" For complete step by step method to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staff/done support How do I ... ? Can I ... ?
Projects
None yet
Development

No branches or pull requests

5 participants