Get national holidays

14

I am making an application and would like to know if there is any way to get national holidays.

For example: Some Google Calendar API where I can get some XML to consume ..

    
asked by anonymous 25.06.2015 / 20:55

5 answers

13

The Multitable has a Webservice in PHP . It is possible to obtain not only national holidays, but also regional holidays.

    
25.06.2015 / 21:09
11

You can use the link which is an API that supports the following countries / regions BE , BR , GB , NO or US (note that it uses ISO 3166-1 alpha-2 which is version alpha ).

Just make a request for the address http://holidayapi.com/v1/holidays that can be used with any language, in C # it should look something like:

WebRequest request = WebRequest.Create("http://holidayapi.com/v1/holidays?country=BR&year=2015");

request.Credentials = CredentialCache.DefaultCredentials;

((HttpWebRequest) request).UserAgent = context.Request.UserAgent;

HttpWebResponse response = (HttpWebResponse) request.GetResponse();

if (response.StatusCode != HttpStatusCode.OK) {
    response.StatusCode.ToString();
} else {
    Stream receiveStream = response.GetResponseStream();

    //Converte a resposta para objeto
}

Or you can download from GitHub: link (see the link )

As an example (unfortunately the repository is only for PHP, but you can use the .json files):

<?php
require '../lib/HolidayAPIv1.php';
$api = new \HolidayAPI\v1($redis);
header('Content-Type: application/json; charset=utf-8');
$flags = JSON_UNESCAPED_UNICODE;
if (isset($_REQUEST['pretty'])) {
    $flags |= JSON_PRETTY_PRINT;
}
echo json_encode($api->getHolidays(), $flags);
    
25.06.2015 / 21:07
3

Elekto (notice: it's my company) provides a free JSONP API, explained in detail here .

It is the API that is used in our working day deadlines tool . The focus, however, is the financial market.

The tool has been in the air since 2012-05, hosted in São Paulo (less latency).

    
01.07.2015 / 02:17
0

The big problem in Brazil is the municipal holidays and the amount of existing cities.

I only found an API that has holidays from all counties. I'm using and it worked fine:

link

It's free, just put the email on this page.

    
30.11.2016 / 05:45
0

In Portugal but without municipalities.

link

    
01.10.2018 / 11:41