Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

java-holiday-api

JDk8 Build Status

A java client library for https://holidayapi.com/

The API provider doesn't have a java client library, so I developed one and it is very simple to use. Lookup https://holidayapi.com/ for required and optional parameters


Logging


The application uses log4j to log events.

Provide the logging configuration by having the file log4j.xml in the classpath.

You can download the pre-configured configuration file from the directory <project_root>/log4j/log4j2.xml


Usage:


Maven dependency

<dependency>
    <groupId>com.github.agogs</groupId>
    <artifactId>java-holiday-api</artifactId>
    <version>1.1</version>
</dependency>

Sample java code

        //create a consumer
        APIConsumer consumer = new HolidayAPIConsumer("https://holidayapi.com/v1/holidays");

        //generate the wuery parameters
        QueryParams params = new QueryParams();
        params.key("your_api_key")
                .month(1)
                .country(QueryParams.Country.INDIA)
                .year(2018)
                //JSON is the default format
                .format(QueryParams.Format.XML)
                .pretty(true);

        try {
            //make the API call
            HolidayAPIResponse response = consumer.getHolidays(params);
            
            //check the status code of the API call
            int status = response.getStatus();
            if (status != 200) {

                //handle error scenario

            } else {

                //handle success scenario

                List<Holiday> holidays = response.getHolidays();
                for (Holiday h : holidays) {
                    //do your thing
                }
            }
        } catch (IOException e) {
            //handle exception
        }

LICENSE

GNU General Public License v3.0

Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.

About

A java client library for https://holidayapi.com/

Resources

License

Releases

No releases published

Packages

No packages published

Languages