JSON Guide For Enrico

Introduction

If you don't know what is JSON, learn more here. You can use JSON to call Enrico from Javascript. Consider using web service interface for other languages or iCalendar interface.

JSON URL

Latest version of JSON URL is here.

Details of Operations

All data coming to and from Enrico is UTF-8 encoded.
getPublicHolidaysForMonth:
  • Sample URL returning public holidays in Germany (Baden-W├╝rttemberg) for January 2013: JSON_URL?action=getPublicHolidaysForMonth&month=1&year=2013&country=ger&region=Baden-W%C3%BCrttemberg
  • See it in action.
getPublicHolidaysForYear:
  • Sample URL returning public holidays in Estonia for 2013: JSON_URL?action=getPublicHolidaysForYear&year=2013&country=est&region=
  • See it in action.
getPublicHolidaysForDateRange:
  • Sample URL returning public holidays in United States of America (District Of Columbia) from 04 July 2012 (including) to 04 July 2014 (including): JSON_URL?action=getPublicHolidaysForDateRange&fromDate=04-07-2012&toDate=04-07-2014&country=usa&region=District+Of+Columbia
  • See it in action.
isPublicHoliday:
  • Sample URL to check if 05 July 2012 is public holiday in Slovakia: JSON_URL?action=isPublicHoliday&date=05-07-2012&country=svk
  • See it in action.
getSupportedCountries:
  • Sample URL to get supported countries: JSON_URL?action=getSupportedCountries
  • See it in action.
Data types:
  • country - countryCode returned from getSupportedCountries operation. See 'Country Code' column.
  • region - one from the regions returned from getSupportedCountries operation. See 'Regions' column. If there is no region defined for the country, this value is ignored by Enrico Service.

JSONP

In each operation you can use JSONP like this:
  • Sample URL returning public holidays in Austria for January 2013: JSON_URL?action=getPublicHolidaysForMonth&month=1&year=2013&country=aut&jsonp=myfunction
  • See it in action.
Learn more about JSONP here.

Examples

Cross-domain Ajax Calls

There are 3 ways how to do cross-domain calls using ajax.
  1. Enrico Service supports CORS so you can freely do cross-domain calls to Enrico Service from any domain. You can use JSON_URL in the form stated above. Learn more about CORS here.
  2. Use proxy php script on your server. Place this script onto your server and use url to that script on your server as JSON_URL.
  3. JSONP. Read about JSONP above and see Examples section.
Enrico is powered by Kayapo