As of December 31st, 2023 ThreadFix 2.X has reached End of Life and is no longer supported. For any further information please contact the Success and Implementation team.

Create Scheduled Email Report - API

/rest/{version}/scheduledEmailReport/add


Descriptor

Value

HTTP Method

POST

Description

Creates a new scheduled email report.

Required Permission

Manage Email Reports (Global level)

Version Introduced2.7.4


Request Header Parameters

Parameter

Value

Required

Description

Accept

String

Yes

A value of ‘application/json’ must be provided.


Request POST Data Parameters

Parameter

Value

Required

Description

teamIds

Integer

Yes

The ID for the teams to attach to the report.  At least one team must be specified.  See the example below to see how to pass in multiple teams.

severity

String

Yes

The name of the severity for the report's severity threshold.  If you have customized your ThreadFix severity names, use your custom names.

schedulingMethodStringNoWhich type of schedule you will define.  Must be either "SELECT" or "CRON", case-insenstive, but will default to "SELECT" if not specified.
frequencyStringYes*

*Required if using "SELECT" schedulingMethod.

Must be either "Weekly" or "Daily", case-insenstive.  Determines whether schedule will be every day or only on a specified day of the week.

dayStringYes*

*Required if using "SELECT" schedulingMethod and a "Weekly" frequency.

The day of the week the report will execute.  Must be the full name of the day of the week, for example: "Wednesday".

hourIntegerYes*

*Required if using "SELECT" schedulingMethod.

The hour (1-12) for the time the report will execute.

minuteIntegerYes*

*Required if using "SELECT" schedulingMethod.

The minute the report will execute.  Must be one of: 0, 15, 30, 45.  If you need to specify a more specific minute place, please use a cron expression to define your schedule.

periodStringYes*

*Required if using "SELECT" schedulingMethod.

Must be either "AM" or "PM", for the time the report will execute.

cronExpressionStringYes*

*Required if using "CRON" schedulingMethod.

The Cron expression for the time the schedule will execute.  Cron Expressions in ThreadFix do not accept a "seconds" place, so please omit that from your string.  The "year" is also optional.  For example, to run a schedule every day at 9:13 AM, you would provide "13 9 * * ?".


Sample Call:

Creating a new scheduled email report attached to 1 team, with a severity threshold of "low", and using a cron expression to run the schedule every day at 6 AM:

curl --insecure -H 'Accept: application/json' -H "Authorization: APIKEY {apiKey}" -X POST --data "teamIds=1&severity=low&schedulingMethod=cron&cronExpression=0 6 * * ?" http://localhost:8080/threadfix/rest/latest/scheduledEmailReport/add


Creating a new scheduled email report attached to 2 teams, with a severity threshold of "elevated" (a custom severity name), using the select method to set the schedule to 1:30 PM every Monday:

curl --insecure -H 'Accept: application/json' -H "Authorization: APIKEY {apiKey}" -X POST --data "teamIds=1&teamIds=2&severity=elevated&schedulingMethod=select&frequency=weekly&day=monday&hour=1&minute=30&period=pm" http://localhost:8080/threadfix/rest/latest/scheduledEmailReport/add

Sample Output:


{
    "message": "",
    "success": true,
    "responseCode": -1,
    "object": {
        "id": 19,
        "hour": 0,
        "minute": 0,
        "period": null,
        "day": null,
        "frequency": null,
        "scheduleType": "CRON",
        "cronExpression": "0 6 * * ?",
        "severityLevel": {
            "id": 2,
            "name": "Low",
            "intValue": 2,
            "displayName": "Low"
        },
        "emailLists": [],
        "emailAddresses": [],
        "organizations": [
            {
                "id": 1,
                "name": "Test"
            }
        ],
        "scheduledDate": "at 06:00",
        "cronTranslation": "at 06:00"
    }
}

www.threadfix.it | www.coalfire.com
Copyright © 2024 Coalfire. All rights reserved.

This Information Security Policy is CoalFire - Public: Distribution of this material is not limited.