イベント

フィルターパラメーター

アクションの種類

action パラメータで使用可能なアクションタイプは以下の通り:

  • created
  • updated
  • closed
  • reopened
  • pushed
  • commented
  • merged
  • joined
  • left
  • destroyed
  • expired

これらのオプションはダウンケースされていることに注意してください。

ターゲットの種類

target_type パラメーターで使用可能なターゲットタイプは以下の通り:

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

これらのオプションはダウンケースされていることに注意してください。

日付フォーマット

beforeafter パラメータの日付は以下のフォーマットで指定してください:

YYYY-MM-DD

イベント期間制限

GitLabはパフォーマンス上の理由から、2年以上前のイベントをイベントテーブルから削除します。

現在認証されているユーザーのイベント一覧

注釈:このエンドポイントはGitLab 9.3で導入されました。read_user アクセスはGitLab 11.3で導入されました。

認証されたユーザーのイベント一覧を取得します。スコープread_user またはapi が必要です。

GET /events

パラメーター

属性 タイプ 必須 説明
action いいえ 特定のアクションタイプのイベントのみを含めることができます。
target_type いいえ 特定のターゲット・タイプのイベントのみを含めることができます。
before 日付 いいえ 特定の日付以前に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
after 日付 いいえ 特定の日付以降に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
scope いいえ ユーザーのプロジェクト全体のすべてのイベントを含めます。
sort いいえ asc またはdesc のイベントをcreated_atの順に並べ替えます。 デフォルトは以下の通りです。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"

回答例

[
  {
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":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"
  },
  {
    "title":null,
    "project_id":1,
    "action_name":"opened",
    "target_id":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"
  }
]

ユーザー貢献イベントの取得

Notes:以前はUsers APIページにドキュメントがありました。read_user アクセスはGitLab 11.3で導入されました。

指定したユーザの貢献イベントを、新しいものから古いものへとソートして取得します。 スコープread_user またはapi が必要です。

GET /users/:id/events

パラメーター

属性 タイプ 必須 説明
id 整数 はい ユーザーのIDまたはユーザー名
action いいえ 特定のアクションタイプのイベントのみを含めることができます。
target_type いいえ 特定のターゲット・タイプのイベントのみを含めることができます。
before 日付 いいえ 特定の日付以前に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
after 日付 いいえ 特定の日付以降に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
sort いいえ asc またはdesc のイベントをcreated_atの順に並べ替えます。 デフォルトは以下の通りです。desc
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/:id/events"

回答例

[
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 830,
    "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"
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "pushed",
    "target_id": 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": "master",
      "commit_title": "Add simple search to projects in public area"
    },
    "target_title": null
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "closed",
    "target_id": 840,
    "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"
  },
  {
    "title": null,
    "project_id": 15,
    "action_name": "commented on",
    "target_id": 1312,
    "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"
  }
]

プロジェクトの可視イベントをリストアップします。

注:このエンドポイントは、他のエンドポイントよりも古くから存在しています。 ドキュメントは、以前はProjects APIページにありました。

特定のプロジェクトの可視イベントのリストを取得します。

GET /projects/:project_id/events

パラメーター

属性 タイプ 必須 説明
project_id 整数/文字列 はい プロジェクトのIDまたはURLエンコードされたパス
action いいえ 特定のアクションタイプのイベントのみを含めることができます。
target_type いいえ 特定のターゲット・タイプのイベントのみを含めることができます。
before 日付 いいえ 特定の日付以前に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
after 日付 いいえ 特定の日付以降に作成されたイベントのみを含めます。サポートされているフォーマットについては、こちらをご覧ください。
sort いいえ asc またはdesc のイベントをcreated_atの順に並べ替えます。 デフォルトは以下の通りです。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"

回答例

[
  {
    "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"
  },
  {
    "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"
  },
  {
    "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"
  }
]