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

Hi,

if Postman is able to connect with instance then the API is available from any public network

Please inform 3rd party team to check with postman

Possibly their application is in internal network and firewall is blocking reaching ServiceNow endpoint.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello @Ankur Bawiskar .,

Yes i suspect the same @firewall or network issue. More or less the application is itself inside a private network. But if it is going to be a network err then we must get timeOUT or hostNOT rechable err?

Hi,

It is the responsibility of 3rd party team on how they allow the API consumption from their internal network.

Till the time your API works from Postman you should be good and nothing you should worry from your side.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello @Ankur Bawiskar .,

I am curious to ask one more question - 

@System Log >> Transation - i get to see Postman log stamps but not a single entry from the 3rd party application.

When you say -  how they allow the API consumption from their internal network. I can frame the ans 'coz i know how they are getting authenticated with the instance.

Even if authentication is not allowing i will get log details that authFailure.

So my question is "How the initial connectivity can be confirmed from our end --iMean-- from Instance admin end?

Hi,

you can only test your API from Postman side

How it behaves from external team's point of view can only be checked when you get into meeting with them

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader