RubenLaguna
RubenLaguna

Reputation: 24806

How can I get the timeline events of a GitLab Incident via the REST API?

The GitLab timeline events are described at Incident Management > Timeline events

I tried to get to the timeline events using the Issues API and Notes API but it seems that the the timeline events are NOT notes. The only notes I find in the Incident issue are the comments in the issue activity like "added an incident timeline event" but not the actual timeline event which should contain labels like "Impact detected" / "End time".

This is an example of what I can get via the Notes API:

curl --location 'https://xxxxxxx/api/v4/projects/131/issues/1/notes' \
--header 'PRIVATE-TOKEN: xxxxxx'
{
...
   {
        "id": 33288,
        "type": null,
        "body": "added an incident timeline event",
        "attachment": null,
        "author": {
            ....
        },
        "created_at": "2024-01-25T14:06:00.377Z",
        "updated_at": "2024-01-25T14:06:00.384Z",
        "system": true,
        "noteable_id": 94,
        "noteable_type": "Issue",
        "project_id": 131,
        "resolvable": false,
        "confidential": false,
        "internal": false,
        "noteable_iid": 1,
        "commands_changes": {}
    },
...
}


I also tried the Events API but timeline events do not show there either, only events like the creation of the issue, merge request, etc but not actual timeline events on an Incident.

I also checked out the resource_milestone_events, resource_label_events, resource_iteration_events and resource_state_events but they don't return anything related to Incident's timeline events.

So how can I extract the timeline events from a gitlab issue (incident type) programmatically (via API)?

Upvotes: 1

Views: 315

Answers (1)

RubenLaguna
RubenLaguna

Reputation: 24806

Currently on 2024-02-07 there is no way to get the timeline events of an incident via the REST API. This was reported at https://gitlab.com/gitlab-org/gitlab/-/issues/439853

Upvotes: 1

Related Questions