在 JSON 中进行 REST 调用和获取输出的 Jenkins 插件

Jenkins plugin to make REST calls and fetch output in JSON

请建议在 Jenkins 声明式管道中实现以下功能的插件或方法。

您本身不需要任何插件,因为您可以使用例如curl:

def calendar_url = "https://calendarific.com/api/v2/holidays?&api_key=758f54db8c52c2b500c928282fe83af1b1aa2be8&country=IN&year=2020"

def curl_output = sh returnStdout: true, script: "curl -s ${calendar_url}"

您可以使用 readJson utility:

将其转换为 json
def holidays = readJson text: curl_output
for (holiday in holidays.response.holidays) {
    def holiday_date = holiday.date.iso
    println holiday_date
}

定义当前日期并退出构建留给实施者作为练习:)