Newman returning 404 but postman returns 400 for the same request

Here is the response from newman. We are using the latest version of newman and latest version of node.

This is the output from XML reporter

Error Message

expected response to have status code 400 but got 404


    Failed 1 times.
    Collection JSON ID: 0e3df960-cfd7-4ea1-9e65-244ea09478d4.
    Collection name: Error-codes.
    Request name: APIS / mapping settings / Put mapping-settings resources unset.
    Test description: AUTO002 - PUT 400 status correct..
    Error message: expected response to have status code 400 but got 404.
    Stacktrace: AssertionError: expected response to have status code 400 but got 404

at Object.eval sandbox-script.js:1:3).

Below is the output from reportportal reporter.

Request: URL:

2020-07-07 01:38:39

Request: Method: PUT

2020-07-07 01:38:39

Request: Headers: Content-Type:application/json,Accept:application/vnd.hedtech.integration.v1.0.0+json,X-CustomCredentials:XXXX

2020-07-07 01:38:39

Request: Body: {
“id”: “9ec807e1-507b-44c8-9fb3-b33434b28e78”,
“title”: “Award Categories”,
“resource”: “”



2020-07-07 01:38:39

Response: Body: {“errors”:[{“id”:“9ec807e1-507b-44c8-9fb3-b33434b28e78”,“sourceId”:“17CANL”,“code”:“Validation.Exception”,“description”:“An error occurred attempting to validate data.”,“message”:“mappingSettings.Missing.Resource: Ethos resource is required.”},{“id”:“9ec807e1-507b-44c8-9fb3-b33434b28e78”,“sourceId”:“17CANL”,“code”:“Validation.Exception”,“description”:“An error occurred attempting to validate data.”,“message”:“mappingSettings.Missing.PropertyName: Ethos property name is required.”},{“code”:“Global.Internal.Error”,“description”:“Unspecified Error on the system which prevented execution.”,“message”:“Error(s) occurred updating mapping-settings ‘9ec807e1-507b-44c8-9fb3-b33434b28e78’”}]}

2020-07-07 01:38:44

Response: Status: Not Found

2020-07-07 01:38:44

Response: Code: 404

2020-07-07 01:38:44

Response: Headers: Cache-Control:no-cache,Pragma:no-cache,Content-Length:692,Content-Type:text/plain; charset=utf-8,Expires:-1,Server:Microsoft-IIS/10.0,X-CustomCredentials:,X-Media-Type:application/vnd.hedtech.integration.errors.v2+json,X-AspNet-Version:4.0.30319,X-Powered-By:ASP.NET,Date:Tue, 07 Jul 2020 05:38:36 GMT

Here are my postman screenshots. I am not sure why postman and newman return different code.

Hi @asainju,

Reading the response bodies, it seems the access token you’re using in Postman is no longer valid. 400 isn’t as helpful an error response code as 401 would be in this case. I’d check your access credentials or token in Postman.



Sorry posted the wrong screenshot for the postman. I just updated with correct screenshot.

Hey @asainju,

This seems like a server-side issue.

One thing to look at on the server-side, perhaps… Are you using PUT for both create and update operations? Perhaps it is expecting to be update-only and the resource doesn’t exist at the time Newman fires off the request (which would be strange, as the PUT method indicates a create-or-update operation, but I thought it might be worth checking). Of course, this still makes its validation error response kind of weird.

In any case, I’m not sure how Newman (or Postman) would be reporting this incorrectly.

Best of luck,