PFB my code:

var myApp4=angular.module("upcomingEvents",[]);
    $scope.today=new Date();
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/lists/getbytitle('Calendar')/items?$filter=EventDate ge datetime'"+$scope.today+"'", 
    method: "GET", 
    headers: { "Accept": "application/json;odata=verbose" } 
    }).then(function success(data)

function error(data)


But am getting Failed to load resource: the server responded with a status of 400 (Bad Request) error.

Thanks in advance.


You have to encode the ISOString. The query fails since it contains the ::

"/_api/lists/getbytitle('Calendar')/items?$filter=EventDate ge datetime'2018-01-01T00:00:00'"

Encoding it you get:

"/_api/lists/getbytitle('Calendar')/items?$filter=EventDate ge datetime'2014-01-01T00%3A00%3A00%0A'"
  • I tred to encode it using EncodeURIComponent but still no use – Dheeraj Sep 19 '18 at 5:17
  • Do you still get BadRequest? – Emaborsa Sep 19 '18 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.