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.

How to add query parameters in rest api and call using rest message

SupriyaWaghmode
Kilo Sage
Kilo Sage

I have below end point :

https://api12preview.sapsf.eu/odata/v2/EmpJob?$filter=lastModifiedDateTime+gt+datetimeoffset'2024-03-03T00:00:00Z'>> in to replace this date and time for every day running scheduled job.

 

 

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, hopefully this will help you with possible solution

var myURLBase = "https://api12preview.sapsf.eu/odata/v2/EmpJob?$filter=lastModifiedDateTime+gt+datetimeoffset'";
var myURLSuffix = "T00:00:00Z'";
var gdt = new GlideDateTime();
gs.info('Today ' + gdt.getDate());

gdt.addDays(-1);
gs.info('Yesterday ' + gdt.getDate());

var myURL = myURLBase + gdt.getDate() + myURLSuffix;

gs.info(myURL);

 

View solution in original post

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, hopefully this will help you with possible solution

var myURLBase = "https://api12preview.sapsf.eu/odata/v2/EmpJob?$filter=lastModifiedDateTime+gt+datetimeoffset'";
var myURLSuffix = "T00:00:00Z'";
var gdt = new GlideDateTime();
gs.info('Today ' + gdt.getDate());

gdt.addDays(-1);
gs.info('Yesterday ' + gdt.getDate());

var myURL = myURLBase + gdt.getDate() + myURLSuffix;

gs.info(myURL);