Free and easy-to-use holiday API

This is a holiday API developed by myself in my spare time, and it is freely available to those who need it. And has a TTS interface, which can directly return human-friendly and readable Chinese results, which can be directly converted to voice playback. Continuous update.

API address:  http://lanfly.vicp.io/api/holiday

Terms and Conditions

  1. This is a holiday API developed by myself in my spare time.
  2. Use it in your own hobby projects and make it free for those who need it.
  3. Holidays every year I will update as soon as possible.
  4. If you find that a holiday is misconfigured or not configured, please contact me.
  5. If you have other needs, please contact me, and strive to provide you with better and more stable services.
  6. The text interfaces are all configurable.

Contact information

[email protected]

API Documentation

Get holiday information on a specified date

Interface address: http://lanfly.vicp.io/api/holiday/info/$date

@params $date: A string specifying the date in the format '2018-02-23'. Can be omitted, the default server's current time.

@return json: If it is not a holiday, the holiday field is null.

{
    "code": 0,               // 0服务正常。-1服务出错
    "holiday": {
        "holiday": false,     // true表示是节假日,false表示是调休
        "name": "国庆前调休",   // 节假日的中文名。如果是调休,则是调休的中文名,例如'国庆前调休'
        "wage": 1,            // 薪资倍数,1表示是1倍工资
        "after": false,       // 只在调休下有该字段。true表示放完假后调休,false表示先调休再放假
        "target": '国庆节'     // 只在调休下有该字段。表示调休的节假日
    }
}

Example:

http://lanfly.vicp.io/api/holiday/info/2018-3-2

http://lanfly.vicp.io/api/holiday/info/2018-03-02

http://lanfly.vicp.io/api/holiday/info

Get the next holiday of the specified date (if there is a holiday before the holiday, it will also return)

Interface address: http://lanfly.vicp.io/api/holiday/next/$date

@params $data: A string specifying the date in the format '2018-02-23'. Can be omitted, the default server's current time.

@return json: Returns the next nearest holiday on the specified date. If you want to take a holiday before the holiday, it will return the information of the holiday together.

{
    "code": 0,               // 0服务正常。-1服务出错
    "holiday": {
        "holiday": true,     // 该字段一定为true
        "name": "国庆节",     // 节假日的中文名。
        "wage": 3,           // 薪资倍数,3表示是3倍工资
        "date": "2018-10-01" // 节假日的日期
    },
    "workday": {             // 如果节假日前没调休,则此字段为null
        "holiday": false,    // 此字段一定为false
        "name": "国庆前调休",  // 调休的中文名
        "wage": 1,           // 薪资倍数,3表示是3倍工资
        "after": false,      // true表示放完假后调休,false表示先调休再放假
        "target": '国庆节',   // 表示调休的节假日
        "date": "2018-09-29" // 表示要调休的日期
    }
}

Example:

http://lanfly.vicp.io/api/holiday/next/2018-6-1

http://lanfly.vicp.io/api/holiday/next/2018-09-28

http://lanfly.vicp.io/api/holiday/next

Below is the high-level API. Returns human-readable text, suitable for speech interactions.

For example: use text-to-speech to play the returned result directly. It is suitable for use in VUI voice interaction.

Return text. A holiday arrangement closest to today. Saturdays, weekends, holidays, and holidays will be considered for a more comprehensive holiday arrangement.

Interface address: http://lanfly.vicp.io/api/holiday/tts

@params : no parameters

@return json: Returns directly playable text.

{
    "code": 0,               // 0服务正常。-1服务出错
    "tts": "明天就是周六了,今天努力工作哦!。最近的一个节日是清明节。还要12天。早着呢!"
}

Example statement:

It's the weekend, take it easy!

Today is the holiday before the National Day, tomorrow is the National Day, come on!

What are you thinking! Today is National Day.

The Qingming Festival has just ended. Today is the Qingming Festival holiday, so let's go to work honestly.

I'm sorry to tell you that this Saturday will be closed before Labor Day, but Sunday is Labor Day.

I'm sorry to tell you that this Saturday and Sunday will be closed before the National Day. In 3 days it will be National Day.

Tomorrow is the Mid-Autumn Festival, are you happy? But remember to take the Mid-Autumn Festival holiday on Sunday, set the alarm clock, and don't play too much.

Tomorrow is Saturday, work hard today! The most recent festival is Qingming Festival. 12 more days. It's early!

There are many other situations that are not listed one by one. At present, there are about 2/3 of ten different expressions. In short, I will try to use human-friendly expressions as much as possible.

Return text. The closest holiday to today. Only consider holidays and sabbaticals.

Interface address: http://lanfly.vicp.io/api/holiday/tts/next

@params: no parameters

@return json: Returns directly playable text.

{
    "code": 0,               // 0服务正常。-1服务出错
    "tts": "最近的一个节日是2018-04-05的清明节,还有11天。"
}

Example statement:

All the holidays this year are over, and the holiday developers in 2019 are still lazy.

The most recent festival is the Qingming Festival on 2018-04-05, and there are 11 days left.

The most recent holiday is Labor Day on 2018-04-28, and there are 9 days left. Before that, it is necessary to take a holiday before Labor Day.

The most recent holiday is Labor Day on 2018-04-28, and there are 2 days left. But remember to take a day off before Labor Day tomorrow.

The most recent holiday is Labor Day on 2018-04-28, and there are 21 days left. Tomorrow, remember to take a holiday for Qingming Festival.

The most recent holiday is Labor Day on 2018-04-28, and there are 22 days left. Before that, let's finish the Qingming Festival.

More examples are not listed one by one, and the expressions of tomorrow, the day after tomorrow, etc. will be adjusted according to different times.

Return text. The answer is to have a holiday tomorrow.

Interface address: http://lanfly.vicp.io/api/holiday/tts/tomorrow

@params: no parameters

@return json: Returns directly playable text.

{
    "code": 0,               // 0服务正常。-1服务出错
    "tts": "明天是周一,今晚早点睡,上班别迟到了。"
}

Example statement:

Tomorrow is Labor Day, take advantage of the holiday to relax.

Tomb-sweeping Day has just ended, and tomorrow will be a holiday for Tomb-sweeping Day, so I'm still thinking about taking a holiday!

Tomorrow is Saturday, go to sleep.

It's only Tuesday, so let's go to work first.

There will be no holiday tomorrow. Tomorrow is the holiday before Labor Day. It will be Labor Day soon. Be happy!

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325130283&siteId=291194637