POST request 404 not found

Hello Postman helpers,

I am just getting started in testing with POSTMAN. I am having a response when I choose GET request, but when I change it to POST, I get a 404 not found error, even with or without header and body.

Am I missing something? I appreciate any help, please.

if your endpoint is to get a request , it will only get a response in body x, y ,z.
If you change that endpoint to POST it will not work.
you need the POST endpoint and request to work. Generally, 404 error, when your request is bad. for eg missing something in the request or parameters in headers. hope this helps!

It’s possible the API you’re trying to hit doesn’t support a POST at that endpoint.

1 Like

@noussalicious There could be a possibility in which .htaccess is set to either redirect or block a POST, which would not catch and block or route a GET. If you can navigate to the page (which you say you can), but a POST never gets there then something is blocking it and the only thing in the way is the web server platform that you’re using.

@kamalshree2784 I have a similar issue using nginx. I have an API which supports only post methods. I can see the requests on my src logs, but I don’t get a response in nginx.

In cases where the request is bad or the parameter not found and the endpoint returns a 404 Not Found, is it possible to test for that?

I tried:

pm.test("Response to not be 404",  () => {
	pm.response.to.have.status(200);
});

But it doesn’t work. My runner gets stopped due to a JSONError: No data, empty input at 1:1^.

Ideally, I would like to test and ignore that request if test fails and not have the run get stopped.