Skip to content

feat: create maintenance incident type via API - #510

Open
borisjacquot wants to merge 1 commit into
rajnandan1:mainfrom
borisjacquot:feat/set-incident-type
Open

feat: create maintenance incident type via API#510
borisjacquot wants to merge 1 commit into
rajnandan1:mainfrom
borisjacquot:feat/set-incident-type

Conversation

@borisjacquot

Copy link
Copy Markdown

Hi! I wanted to create a Maintenance via the API but it is currently not possible.

Summary

This PR allows to give 2 more parameters in the API:

  • incident_type
  • end_date_time

It also adds a new check inside CreateIncident() in order to avoid dirty values in the DB.

API calls

Create a Maintenance

POST /api/incident
{
    "title": "Test maintenance",
    "start_date_time": 1762268631,
    "end_date_time": 1762272231,
    "incident_type": "MAINTENANCE"
}

RESPONSE -> 201
{
    "id": 9,
    "start_date_time": 1762268631,
    "end_date_time": 1762272231,
    "created_at": "2025-11-04 12:42:52",
    "updated_at": "2025-11-04 12:42:52",
    "title": "Test maintenance",
    "status": "OPEN",
    "state": "INVESTIGATING"
}

Create an incident with a wrong type

POST /api/incident
{
    "title": "Test maintenance",
    "start_date_time": 1762260039,
    "end_date_time": 1762268631,
    "incident_type": "MAINTENANCEEEE"
}

RESPONSE -> 400
{
    "error": "Incident type must be either INCIDENT or MAINTENANCE"
}

Notes

I noticed that creating a maintenance in this way, the state was set to "INVESTIGATING" instead of "RESOLVED" (when creating via web UI). It looks impactless but I'm not aware of the whole workflows.

Fixes #468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Maintenance Event via the API

1 participant