Skip to content

Create GitLab webhook event

Request

Register and start to process GitLab repository event. For now only push and create merge request events are supported.

Security
GitlabApiKey
Bodyapplication/jsonrequired
One of:
object_kindstringrequired

Type of webhook event data.

Example:"push"
beforestringrequired

The SHA of the most recent commit on ref before the push.

Example:"95790bf891e76fee5e1747ab589903a6a1f80f22"
afterstringrequired

The SHA of the most recent commit on ref after the push.

Example:"da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
refstringrequired

The full git ref that is pushed. Example: refs/heads/main.

Example:"refs/heads/main"
checkout_shastringrequired

The SHA of the most recent commit on ref after the push.

Example:"da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
user_idintegerrequired

Id of a gitlab user.

Example:1
user_namestringrequired

Name of a gitlab user.

Example:"John"
user_usernamestringrequired

Nickname of a gitlab user.

Example:"john87"
user_emailstringrequired

Email of a gitlab user.

Example:"john87@email.com"
user_avatarstringrequired

User avatar url.

Example:"https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80"
project_idintegerrequired

Project id.

Example:15
projectobject(Project)required

GitLab Project details.

repositoryobject(Repository)required

GitLab repository details.

commitsArray of objects(Commit)required

An array of commit objects describing the pushed commits. (Pushed commits are all commits that are included in the compare between the before commit and the after commit.) The array includes a maximum of 20 commits.

total_commits_countintegerrequired

Contains the actual number of commits.

Example:34
curl -i -X POST \
  https://redocly.com/_mock/docs/realm/scout/agent-api/openapi/webhooks/gitlab \
  -H 'Content-Type: application/json' \
  -H 'x-gitlab-token: YOUR_API_KEY_HERE' \
  -d '{
    "object_kind": "push",
    "before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
    "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
    "ref": "refs/heads/main",
    "checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
    "user_id": 1,
    "user_name": "John",
    "user_username": "john87",
    "user_email": "john87@email.com",
    "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
    "project_id": 15,
    "project": {
      "id": 0,
      "name": "string",
      "description": "string",
      "web_url": "http://example.com/gitlabhq/gitlab-test",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40&d=identicon",
      "git_ssh_url": "ssh://git@example.com/gitlabhq/gitlab-test.git",
      "git_http_url": "http://example.com/gitlabhq/gitlab-test.git",
      "namespace": "GitlabHQ",
      "visibility_level": 20,
      "path_with_namespace": "gitlabhq/gitlab-test",
      "default_branch": "develop",
      "homepage": "http://example.com/gitlabhq/gitlab-test",
      "url": "http://example.com/gitlabhq/gitlab-test.git",
      "ssh_url": "ssh://git@example.com/gitlabhq/gitlab-test.git",
      "http_url": "http://example.com/gitlabhq/gitlab-test.git"
    },
    "repository": {
      "name": "Awesome project",
      "url": "http://example.com/gitlabhq/awesome-project.git",
      "description": "Awesome project description.",
      "homepage": "http://example.com/gitlabhq/awesome-project",
      "git_http_url": "http://example.com/gitlabhq/gitlab-test.git",
      "git_ssh_url": "ssh://git@example.com/gitlabhq/gitlab-test.git",
      "web_url": "http://example.com/gitlabhq/awesome-project",
      "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40&d=identicon",
      "visibility_level": 20
    },
    "commits": [
      {
        "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
        "message": "fixed readme",
        "timestamp": "2019-08-24T14:15:22Z",
        "url": "http://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
        "author": {
          "name": "John",
          "email": "john.doe@email.com"
        },
        "added": [
          "CHANGELOG"
        ],
        "modified": [
          "app/controller/application.rb"
        ],
        "removed": [
          "app/controller/product.rb"
        ]
      }
    ],
    "total_commits_count": 34
  }'

Responses

OK.

Bodyapplication/problem+json
messagestring

A human-readable message with more details.

Example:"Job created"
eventstring

Type of incoming webhook event.

Example:"push"
jobIdstring

Created Scout job ID.

Example:"sjob_01h4gev6h1j50ge5z3yn28ge5e"
Response
{ "message": "Job created", "event": "push", "jobId": "sjob_01h4gev6h1j50ge5z3yn28ge5e" }