Error code while trying to get data through REST API

SNOW46
Tera Contributor

Hi All,

I am trying to integrate Asset Explorer Manage Engine with ServiceNow inorder to pull the Asset Data as well as data for CMDB CI's.

I have configured one Midserver for the same and created one Rest Message also with Authentication type as Basic and Basic auth profile as PersonalAuth.

When I click on test in HTTP Request, its throwing the below error in the response instead of pulling the records.

<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0">
<response>
<operation name="">
<result>
<statuscode>3001</statuscode>
<status>Unknown error</status>
<message>Error when processing request - null</message>
</result>
</operation>
</response>
</API>

I am not getting why the status code is coming as "3001" and the message is "Error when processing request" but the HTTP Status is 200.
 
Can anyone let me know on the same.
 
Thanks,
SNOW@Das

 

2 REPLIES 2

anubhavkapoor76
ServiceNow Employee
ServiceNow Employee

at first glance error seems to be from the Other end  from which the REST API is bringing the date from.Few things you can try

1) Clear cache and try again the service in some REST Client such as POSTMAN.

2) Restart the Mid Server and redo step 1.

Mark helpful if it works for you.

Cheers!!

Anubhav

GeorgeT1
Kilo Explorer

Faced this issue and and though the error is vague, I solved this issue by providing the AuthToken not as a header, but as part of the input data.

 

# Add Technician_Key key to data array

data = {
        'INPUT_DATA': input_data,
        'OPERATION_NAME' : 'add',
        'format' : 'json',
        'TECHNICIAN_KEY': "API-TOKEN"
        }

# Remove header from the post request

response = requests.post(url,data=data,verify=False)