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

Is there a template of how apiCALL should be done and the best practise? as it was advised to check from apiScript end that is the stage we are now.

Hi,

We usually test the API we create in ServiceNow from Postman tool to verify it can be reached and response received is as per agreed with 3rd party

Regards
Ankur

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

Gauthamraj1
Tera Contributor

Hi Kingtan,

Did you check whether the third-party application has necessary SSL certificates to connect to your instance?
You can check the certificates from the address bar on your browser.

Regards,

Gautham

Hi Gautham.,

Thanks for your hand @Gauthamraj 

I see no such SSL entities @addressBar. Is there anyway i can navigate @instance application navigator to find this?

Gauthamraj1
Tera Contributor

Hi Kingstan,

Its not something we manually load in the instance but maintained from the ServiceNow Server end. In a another integration when I faced a similar issue, I simply extracted the public certificates from the address bar using the 'Copy to file' option under the 'Details' section and shared it with the application team. They incorporated the certificates into their application and the issue was resolved.

find_real_file.png

Regards,

Gautham