issues

Create an issue link

Creates a two-way relationship between two issues. The user must be allowed to update both issues to succeed.

post/api/v4/projects/{id}/issues/{issue_iid}/links

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of the project owned by the authenticated user

issue_iidinteger required

The internal ID of a project’s issue

Request body

target_project_idstring required

The ID or URL-encoded path of a target project

target_issue_iidstring required

The internal ID of a target project’s issue

link_type'relates_to' | 'blocks' | 'is_blocked_by'

The type of the relation (“relates_to”, “blocks”, “is_blocked_by”),defaults to “relates_to”)

Response

Create an issue link

idinteger required
link_typestring required

Example response

{
  "id": 1,
  "source_issue": {
    "id": 84,
    "iid": 14,
    "project_id": 4,
    "title": "Impedit et ut et dolores vero provident ullam est",
    "description": "Repellendus impedit et vel velit dignissimos.",
    "state": "closed",
    "created_at": "2022-08-17T12:46:35.053Z",
    "updated_at": "2022-11-14T17:22:01.470Z",
    "closed_at": "2022-11-15T08:30:55.232Z",
    "closed_by": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "labels": [
      "bug"
    ],
    "assignees": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "author": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "type": "ISSUE",
    "assignee": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "start_date": "2022-11-18",
    "due_date": "2022-11-20",
    "issue_type": "issue",
    "web_url": "http://example.com/example/example/issues/14",
    "time_stats": {
      "time_estimate": 12600,
      "total_time_spent": 3600,
      "human_time_estimate": "3h 30m",
      "human_total_time_spent": "1h"
    },
    "task_completion_status": {
      "count": 5,
      "completed_count": 3
    },
    "weight": 5,
    "blocking_issues_count": 2
  },
  "target_issue": {
    "id": 84,
    "iid": 14,
    "project_id": 4,
    "title": "Impedit et ut et dolores vero provident ullam est",
    "description": "Repellendus impedit et vel velit dignissimos.",
    "state": "closed",
    "created_at": "2022-08-17T12:46:35.053Z",
    "updated_at": "2022-11-14T17:22:01.470Z",
    "closed_at": "2022-11-15T08:30:55.232Z",
    "closed_by": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "labels": [
      "bug"
    ],
    "assignees": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "author": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "type": "ISSUE",
    "assignee": {
      "id": 1,
      "username": "admin",
      "public_email": "john@example.com",
      "name": "Administrator",
      "state": "active",
      "avatar_url": "https://gravatar.com/avatar/1",
      "avatar_path": "/user/avatar/28/The-Big-Lebowski-400-400.png",
      "custom_attributes": [
        {
          "key": "foo",
          "value": "bar"
        }
      ],
      "web_url": "https://gitlab.example.com/root"
    },
    "start_date": "2022-11-18",
    "due_date": "2022-11-20",
    "issue_type": "issue",
    "web_url": "http://example.com/example/example/issues/14",
    "time_stats": {
      "time_estimate": 12600,
      "total_time_spent": 3600,
      "human_time_estimate": "3h 30m",
      "human_total_time_spent": "1h"
    },
    "task_completion_status": {
      "count": 5,
      "completed_count": 3
    },
    "weight": 5,
    "blocking_issues_count": 2
  },
  "link_type": "relates_to"
}

Changes

No recorded changes to this operation across all 5 revisions of this API.