This library requests a calendar object and its events provided by a CalDav server.
Specify basic configuration:
config =auth:user: "username"pass: "password"// example using baikal as CalDAV serveruri: "<user name>/<calendar name>";
The request will timeout if it gets no reponse from the CalDav server after 10 seconds.
timeout parameter can be provided to override this default by passing an integer containing the number of milliseconds to wait for the server to send the response before aborting the request.
config =auth:user: "username"pass: "password"uri: "<user name>/<calendar name>"timeout: 20000;
If the request fails with a
401 Unauthorized you might need to send the authentication headers preemptive.
This can be done by setting the
auth.sendImmediately config property to
config =auth:user: "username"pass: "password"sendImmediately: trueuri: "<user name>/<calendar name>";
Fetches the ctag of a calendar. You can use the calendar's ctag to see if anything in the calendar has changed.
const Scrapegoat = ;const scrapegoat = config;scrapegoat;
You'll get an object, which looks like this:
href: '/cal.php/calendars/test/holidays/'name: 'Holiday'ctag: '452'
Fetches the etags of all events. You can use the events etags to see if an event has changed.
You'll get an array of objects, which looks like this:
ics: "/cal.php/calendars/test/holidays/6151613161614616.ics"etag: "fc46dd304e83f572688c68ab63816c8f"ics: "/cal.php/calendars/test/holidays/6816189165131651.ics"etag: "8d59671ba294af1de0e0b154a8ea64c2";
Fetches events with its data/details.
events has to be an array with objects, which contain an ics attribute. The ics attribute has to look like the ones we get with
const events =ics: '/cal.php/calendars/user/calendar_name/12345.ics'ics: '/cal.php/calendars/user/calendar_name/67890.ics';scrapegoat;
Output should be something like this:
ics: "/cal.php/calendars/test/holidays/1234564316516.ics"etag: "fc46dd304e83f572688c68ab63816c8f"data:title: "Holiday: John Doe"uid: "56ea42c0-e4af-4ac8-8d60-d95996c9ddc5"location: "Kissing, Augsburg, Germany"description: nullstart: "2017-02-16T00:00:00.000Z"end: "2017-02-18T00:00:00.000Z"duration:weeks: 0days: 2hours: 0minutes: 0seconds: 0isNegative: falsetype: recurring: false edited: falsecreatedAt: "2017-01-24T15:33:04.000Z";
Fetches all events of the given calendar with data/details.
Fetch all events which occur between
end (have to be valid iCal Dates).
If you leave
end out, you'll get all upcoming events from today.
Passing only one date as a parameter returns all upcoming events from that date.
The end-date must be larger that the start-date.
Example using moment.js for date formatting:
const moment = ;const start =;const end =;scrapegoat;
The example below gets all events happening on a single day
const moment = ;const start = ;const end = ;scrapegoat;