Rest API returns error 400

kingstan
Kilo Expert

Hello Team && @Ankur Bawiskar  .,

We face a problem on restAPI.

Suddenly the request from application XYZ to ServiceNow API in lower environment return error400 bad request.

But via postman i get 200 OK result.

Operation:

HTTP GET https://<InstanceURL>/api/now/table/sys_user?sysparam_query=user_name%ABCDEF

Is there anyway to trace the request so that we can see what is causing the error?

Many thanks.,

Kingstan.

1 ACCEPTED SOLUTION

kingstan
Kilo Expert

@Ankur Bawiskar  && @Gauthamraj : Many thanks for your replies.

The issue is found to be at the Java header of the Client's code by which they try to connect with the ServiceNow Instance. The header having authenticator two times. Since there is some chances done at handshake in MiddleWare side, two authenticator causing some issue for the connection. Thus the bad request.

Sharing this info (withOut sensitive data, ofcourse!) for our use in future someone might get such scenario.

Many thanks again for all your time and knowledge/experience sharing.

 

View solution in original post

19 REPLIES 19

this might be helpful. let me check on this. thanks @Gauthamraj (:

@Gauthamraj : the 3rd party application ABCD is of not-Secure as it is inside a private network. is this can be anyway for being troublemaker?

Hi Kingstan,

It could be a cause. But overall, I think the issue does seem to be with the way the application is configured and consumes our API.

Regards,
Gautham

Quan1
Kilo Contributor

Hi Kingstan,

Please check the logic after function response.setStatus('200'); is called.

kingstan
Kilo Expert

@Ankur Bawiskar  && @Gauthamraj : Many thanks for your replies.

The issue is found to be at the Java header of the Client's code by which they try to connect with the ServiceNow Instance. The header having authenticator two times. Since there is some chances done at handshake in MiddleWare side, two authenticator causing some issue for the connection. Thus the bad request.

Sharing this info (withOut sensitive data, ofcourse!) for our use in future someone might get such scenario.

Many thanks again for all your time and knowledge/experience sharing.