Getting 200 status but not getting Data in response?

lucky24
Tera Contributor

Hi Team,

I Have one scheduled job through which I am calling Rest outbound message in every 10 minute,

In schedule job there is one post method in which I am giving time range (From date and to date) in body.

I am using current date time in "from date" and subtracting 10 minute in current time and passing it in "To date"

like below code

find_real_file.png

By this code I am getting 200 status  but not getting data.

and If I am giving static date value in from and to so I am getting data in response

find_real_file.png

 

Where I am doing Mistake please can someone help me here ...

4 REPLIES 4

Fabian Kunzke
Kilo Sage
Kilo Sage

Hello,

could you provide the logging output from your "from" and "to" variables, please? My guess is, that your date function (var event = new Date(...)) does not track time. I would assume that currently your "to" and "from" values are the same. Might be wrong though. Log would help a lot here.

Regards

Fabian

Akshay14
Tera Guru

I would advice you to use ServiceNow supported GlideDate class instead of new Date().

 

Please find below reference document. 

https://developer.servicenow.com/dev.do#!/reference/api/rome/server/no-namespace/c_GlideDateScopedAPI?navFilter=glidedate

Sunil V
Tera Contributor

Could you please let me know whether it is a OOB scheduled job or Newly created scheduled job. If it is OOB scheduled job could you please let me know the scheduled job name. 

David Patterson
ServiceNow Employee
ServiceNow Employee

The question on its face boils down to "http 200" received - implies no problems with authentication.
If no data is being returned, it could be that the Service Account handling the REST call doesn't have permissions to access the table data being requested.  Check the Groups and Roles of that account to be sure.