Events API

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

필터 매개변수

작업

action 매개변수에 대한 사용 가능한 유형은 사용자 기여 이벤트를 참조하세요. 이러한 옵션은 소문자로 표시됩니다.

대상 유형

target_type 매개변수에 대한 사용 가능한 대상 유형은 다음과 같습니다:

  • issue
  • milestone
  • merge_request
  • note
  • project
  • snippet
  • user

이러한 옵션은 소문자로 표시됩니다. API를 사용하여 에픽과 관련된 이벤트는 사용할 수 없습니다.

날짜 형식

beforeafter 매개변수에 대한 날짜는 다음 형식으로 제공되어야 합니다:

YYYY-MM-DD

이벤트 시간 제한

성능 상의 이유로 GitLab은 3년 이전의 이벤트를 이벤트 테이블에서 제거합니다.

현재 인증된 사용자의 이벤트 목록

인증된 사용자에 대한 이벤트 목록을 가져옵니다. read_user 또는 api 범위가 필요합니다. API를 사용하여 에픽과 관련된 이벤트는 사용할 수 없습니다.

GET /events

매개변수:

속성 유형 필수 설명
action 문자열 아니요 특정 작업 유형의 이벤트만 포함합니다.
target_type 문자열 아니요 특정 대상 유형의 이벤트만 포함합니다.
before 날짜 아니요 특정 날짜 이전에 생성된 이벤트만 포함합니다. 날짜 형식을 확인하세요.
after 날짜 아니요 특정 날짜 이후에 생성된 이벤트만 포함합니다. 날짜 형식을 확인하세요.
scope 문자열 아니요 사용자의 프로젝트 전체를 대상으로 모든 이벤트를 포함합니다.
sort 문자열 아니요 created_at 기준으로 이벤트를 asc 또는 desc 순서로 정렬합니다. 기본값은 desc입니다.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/events?target_type=issue&action=created&after=2017-01-31&before=2017-03-01&scope=all"

예시 응답:

[
  {
    "id": 1,
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":160,
    "target_iid":53,
    "target_type":"Issue",
    "author_id":25,
    "target_title":"Qui natus eos odio tempore et quaerat consequuntur ducimus cupiditate quis.",
    "created_at":"2017-02-09T10:43:19.667Z",
    "author":{
      "name":"User 3",
      "username":"user3",
      "id":25,
      "state":"active",
      "avatar_url":"http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/user3"
    },
    "author_username":"user3"
  },
  {
    "id": 2,
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":159,
    "target_iid":14,
    "target_type":"Issue",
    "author_id":21,
    "target_title":"Nostrum enim non et sed optio illo deleniti non.",
    "created_at":"2017-02-09T10:43:19.426Z",
    "author":{
      "name":"Test User",
      "username":"ted",
      "id":21,
      "state":"active",
      "avatar_url":"http://www.gravatar.com/avatar/80fb888c9a48b9a3f87477214acaa63f?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/ted"
    },
    "author_username":"ted"
  }
]

사용자 기여 이벤트 가져오기

지정된 사용자의 기여 이벤트를 최신부터 최오래순으로 가져옵니다. read_user 또는 api 범위가 필요합니다. API를 사용하여 에픽과 관련된 이벤트는 사용할 수 없습니다.

GET /users/:id/events

매개변수:

속성 유형 필수 설명
id 정수 사용자의 ID 또는 사용자명
action 문자열 아니요 특정 작업 유형의 이벤트만 포함합니다.
target_type 문자열 아니요 특정 대상 유형의 이벤트만 포함합니다.
before 날짜 아니요 특정 날짜 이전에 생성된 이벤트만 포함합니다. 날짜 형식을 확인하세요.
after 날짜 아니요 특정 날짜 이후에 생성된 이벤트만 포함합니다. 날짜 형식을 확인하세요.
sort 문자열 아니요 created_at 기준으로 이벤트를 asc 또는 desc 순서로 정렬합니다. 기본값은 desc입니다.
page 정수 아니요 반환할 결과의 페이지입니다. 기본값은 1입니다.
per_page 정수 아니요 페이지당 결과 수입니다. 기본값은 20입니다.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/:id/events"

예시 응답:

[
  {
    "id": 3,
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 830,
    "target_iid": 82,
    "target_type": "Issue",
    "author_id": 1,
    "target_title": "Public project search field",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/root"
    },
    "author_username": "root"
  },
  {
    "id": 4,
    "title": null,
    "project_id": 15,
    "action_name": "pushed",
    "target_id": null,
    "target_iid": null,
    "target_type": null,
    "author_id": 1,
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/root"
    },
    "author_username": "john",
    "push_data": {
      "commit_count": 1,
      "action": "pushed",
      "ref_type": "branch",
      "commit_from": "50d4420237a9de7be1304607147aec22e4a14af7",
      "commit_to": "c5feabde2d8cd023215af4d2ceeb7a64839fc428",
      "ref": "main",
      "commit_title": "Add simple search to projects in public area"
    },
    "target_title": null
  },
  {
    "id": 5,
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 840,
    "target_iid": 11,
    "target_type": "Issue",
    "author_id": 1,
    "target_title": "Finish & merge Code search PR",
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/root"
    },
    "author_username": "root"
  },
  {
    "id": 7,
    "title": null,
    "project_id": 15,
    "action_name": "commented on",
    "target_id": 1312,
    "target_iid": 61,
    "target_type": "Note",
    "author_id": 1,
    "target_title": null,
    "created_at": "2015-12-04T10:33:58.089Z",
    "note": {
      "id": 1312,
      "body": "What an awesome day!",
      "attachment": null,
      "author": {
        "name": "Dmitriy Zaporozhets",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
        "web_url": "http://localhost:3000/root"
      },
      "created_at": "2015-12-04T10:33:56.698Z",
      "system": false,
      "noteable_id": 377,
      "noteable_type": "Issue"
    },
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://localhost:3000/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "http://localhost:3000/root"
    },
    "author_username": "root"
  }
]

프로젝트의 표시 가능한 이벤트 목록

참고: 이 엔드포인트는 다른 엔드포인트보다 오래되었습니다. 문서는 이전에 프로젝트 API 페이지에 있었습니다.

특정 프로젝트에 대한 표시 가능한 이벤트 목록을 가져옵니다.

GET /projects/:project_id/events

매개변수:

속성 유형 필수 여부 설명
project_id 정수/문자열 프로젝트의 ID 또는 URL 인코딩된 경로
action 문자열 아니요 특정 작업 유형의 이벤트만 포함
target_type 문자열 아니요 특정 대상 유형의 이벤트만 포함
before 날짜 아니요 특정 날짜 이전에 생성된 이벤트만 포함. 날짜 형식 지정 방법을 참조하세요.
after 날짜 아니요 특정 날짜 이후에 생성된 이벤트만 포함. 날짜 형식 지정 방법을 참조하세요.
sort 문자열 아니요 이벤트를 created_at 순서대로 asc 또는 desc로 정렬합니다. 기본값은 desc입니다.

예시 요청:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/:project_id/events?target_type=issue&action=created&after=2017-01-31&before=2017-03-01"

예시 응답:

[
  {
    "id": 8,
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":160,
    "target_iid":160,
    "target_type":"Issue",
    "author_id":25,
    "target_title":"Qui natus eos odio tempore et quaerat consequuntur ducimus cupiditate quis.",
    "created_at":"2017-02-09T10:43:19.667Z",
    "author":{
      "name":"User 3",
      "username":"user3",
      "id":25,
      "state":"active",
      "avatar_url":"http://www.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/user3"
    },
    "author_username":"user3"
  },
  {
    "id": 9,
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":159,
    "target_iid":159,
    "target_type":"Issue",
    "author_id":21,
    "target_title":"Nostrum enim non et sed optio illo deleniti non.",
    "created_at":"2017-02-09T10:43:19.426Z",
    "author":{
      "name":"Test User",
      "username":"ted",
      "id":21,
      "state":"active",
      "avatar_url":"http://www.gravatar.com/avatar/80fb888c9a48b9a3f87477214acaa63f?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/ted"
    },
    "author_username":"ted"
  },
  {
    "id": 10,
    "title": null,
    "project_id": 1,
    "action_name": "commented on",
    "target_id": 1312,
    "target_iid": 1312,
    "target_type": "Note",
    "author_id": 1,
    "data": null,
    "target_title": null,
    "created_at": "2015-12-04T10:33:58.089Z",
    "note": {
      "id": 1312,
      "body": "What an awesome day!",
      "attachment": null,
      "author": {
        "name": "Dmitriy Zaporozhets",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "https://gitlab.example.com/uploads/user/avatar/1/fox_avatar.png",
        "web_url": "https://gitlab.example.com/root"
      },
      "created_at": "2015-12-04T10:33:56.698Z",
      "system": false,
      "noteable_id": 377,
      "noteable_type": "Issue",
      "noteable_iid": 377
    },
    "author": {
      "name": "Dmitriy Zaporozhets",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "https://gitlab.example.com/uploads/user/avatar/1/fox_avatar.png",
      "web_url": "https://gitlab.example.com/root"
    },
    "author_username": "root"
  }
]