Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GET rest api call from sql server to servicenow

synaptris
Kilo Explorer

Hello friends,

      I'm trying to make a GET REST API call to my test developer ServiceNow instance to the incident table. The send is failing and I'm not getting a response back. Please find below my simple code. Can you please help me out what I'm missing?

Thanks many,

Satheesh

Declare @Object as Int;

Declare @ResponseText as Varchar(8000);

--Code Snippet

Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;

Exec sp_OAMethod @Object, 'open', NULL, 'get',

                                'https://dev26169.service-now.com/api/now/table/incident?sysparm_limit=1', 'false'

Exec sp_OAMethod @Object, 'send'

Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

Select @ResponseText

Exec sp_OADestroy @Object

3 REPLIES 3

DilipKumar DJ
Kilo Guru

Hi,



I think its related to authentication. Your SQL server need to pass authentication test before accessing your SNOW server.


synaptris
Kilo Explorer

Hi,



    Thanks for your response. I tried by passing the userid and pwd along, but still got the same response. Can you help me understand how I get my SQL server pass the authentication test please?



Thanks


Satheesh


synaptris
Kilo Explorer

Hi,



    When I try to catch the exception, this is what I'm getting...



hResultsourcedescriptionFailPointMedthodName
0x80072EE2msxml3.dllThe operation timed out   Send failedGET


Please do let me know how I can overcome this.



Thanks


Satheesh