---
title: 보안 결과에 대한 Linear 이슈 생성
description: 보안 결과에 대한 Linear 이슈를 생성합니다. 이 작업은 Datadog에서 케이스를 생성하고 Datadog과 Linear 간의 양방향 동기화를 위해 해당 케이스에 연결된 Linear 이슈를 생성합니다. 요청당 Linear 이슈를 최대 50개까지 생성할 수 있으며…
breadcrumbs: 문서 > API > 보안 결과에 대한 Linear 이슈 생성
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/llms.txt).

# 보안 결과에 대한 Linear 이슈 생성

## v2 (latest)

| Datadog site      | API endpoint                                                              |
| ----------------- | ------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/security/findings/linear_issues     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/security/findings/linear_issues |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/security/findings/linear_issues |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/security/findings/linear_issues      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/security/findings/linear_issues |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/security/findings/linear_issues |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/security/findings/linear_issues |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/security/findings/linear_issues      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/security/findings/linear_issues  |

### Overview

보안 결과에 대한 Linear 이슈를 생성합니다.
이 작업은 Datadog에서 케이스를 생성하고 Datadog과 Linear 간의 양방향 동기화를 위해 해당 케이스에 연결된 Linear 이슈를 생성합니다. 요청당 Linear 이슈를 최대 50개까지 생성할 수 있으며 Linear 이슈당 보안 결과를 최대 50개까지 연결할 수 있습니다. 이미 다른 Linear 이슈에 첨부된 보안 결과는 이전 Linear 이슈에서 분리되어 새로 생성된 Linear 이슈에 첨부됩니다.

This endpoint requires any of the following permissions:

- `security_monitoring_findings_write`
- `appsec_vm_write`

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field  | Field                 | Type     | Description                                                                                                                                                                                                                    |
| ------------- | --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|               | data [*required*]     | [object] | 보안 결과에 대한 Linear 이슈 생성 요청 목록입니다.                                                                                                                                                                                               |
| data          | attributes            | object   | Attributes of the Linear issue to create.                                                                                                                                                                                      |
| attributes    | assignee_id           | string   | Unique identifier of the Datadog user assigned to the Linear issue.                                                                                                                                                            |
| attributes    | description           | string   | Description of the Linear issue. If not provided, the description will be automatically generated.                                                                                                                             |
| attributes    | label_ids             | [string] | Linear label IDs to set on the created issue.                                                                                                                                                                                  |
| attributes    | linear_project_id     | string   | Unique identifier of the Linear project to pin the issue to. If not provided, the issue is not associated with a Linear project.                                                                                               |
| attributes    | priority              | enum     | Datadog case priority mapped to the Linear issue priority. If not provided, the priority will be automatically set to "NOT_DEFINED". Allowed enum values: `NOT_DEFINED`, `P1`, `P2`, `P3`, `P4`, `P5`. Default: `NOT_DEFINED`. |
| attributes    | title                 | string   | Title of the Linear issue. If not provided, the title will be automatically generated.                                                                                                                                         |
| data          | relationships         | object   | Relationships of the Linear issue to create.                                                                                                                                                                                   |
| relationships | findings [*required*] | object   | Security findings to create a Linear issue for.                                                                                                                                                                                |
| findings      | data                  | [object] | Array of security finding data objects.                                                                                                                                                                                        |
| data          | id [*required*]       | string   | Unique identifier of the security finding.                                                                                                                                                                                     |
| data          | type [*required*]     | enum     | Security findings resource type. Allowed enum values: `findings`. Default: `findings`.                                                                                                                                         |
| relationships | project [*required*]  | object   | Case management project configured with the Linear integration. It is used to create the Linear issue.                                                                                                                         |
| project       | data [*required*]     | object   | Data object representing a case management project.                                                                                                                                                                            |
| data          | id [*required*]       | string   | Unique identifier of the case management project.                                                                                                                                                                              |
| data          | type [*required*]     | enum     | Projects resource type. Allowed enum values: `projects`. Default: `projects`.                                                                                                                                                  |
| data          | type [*required*]     | enum     | Linear issues resource type. Allowed enum values: `linear_issues`. Default: `linear_issues`.                                                                                                                                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
        "description": "A description of the Linear issue.",
        "label_ids": [
          "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
        ],
        "linear_project_id": "d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d",
        "priority": "P4",
        "title": "A title for the Linear issue."
      },
      "relationships": {
        "findings": {
          "data": [
            {
              "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
              "type": "findings"
            }
          ]
        },
        "project": {
          "data": {
            "id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
            "type": "projects"
          }
        }
      },
      "type": "linear_issues"
    }
  ]
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="201" %}
Created

{% tabs %}
{% tab label="Model" %}
List of case responses.

| Parent field         | Field             | Type      | Description                                                                                                                                            |
| -------------------- | ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                      | data [*required*] | [object]  | Array of case response data objects.                                                                                                                   |
| data                 | attributes        | object    | Attributes of the case.                                                                                                                                |
| attributes           | archived_at       | date-time | Timestamp of when the case was archived.                                                                                                               |
| attributes           | assigned_to       | object    | User assigned to the case.                                                                                                                             |
| assigned_to          | data [*required*] | object    | Relationship to user object.                                                                                                                           |
| data                 | id [*required*]   | string    | A unique identifier that represents the user.                                                                                                          |
| data                 | type [*required*] | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                   |
| attributes           | attributes        | object    | Custom attributes associated with the case as key-value pairs where values are string arrays.                                                          |
| additionalProperties | <any-key>         | [string]  |                                                                                                                                                        |
| attributes           | closed_at         | date-time | Timestamp of when the case was closed.                                                                                                                 |
| attributes           | created_at        | date-time | Timestamp of when the case was created.                                                                                                                |
| attributes           | creation_source   | string    | Source of the case creation.                                                                                                                           |
| attributes           | description       | string    | Description of the case.                                                                                                                               |
| attributes           | due_date          | string    | Due date of the case.                                                                                                                                  |
| attributes           | insights          | [object]  | Insights of the case.                                                                                                                                  |
| insights             | ref               | string    | Reference of the insight.                                                                                                                              |
| insights             | resource_id       | string    | Unique identifier of the resource. For example, the unique identifier of a security finding.                                                           |
| insights             | type              | string    | Type of the resource. For example, the type of a security finding is "SECURITY_FINDING".                                                               |
| attributes           | jira_issue        | object    | Jira issue associated with the case.                                                                                                                   |
| jira_issue           | error_message     | string    | Error message if the Jira issue creation failed.                                                                                                       |
| jira_issue           | result            | object    | Result of the Jira issue creation.                                                                                                                     |
| result               | account_id        | string    | Account ID of the Jira issue.                                                                                                                          |
| result               | issue_id          | string    | Unique identifier of the Jira issue.                                                                                                                   |
| result               | issue_key         | string    | Key of the Jira issue.                                                                                                                                 |
| result               | issue_url         | string    | URL of the Jira issue.                                                                                                                                 |
| jira_issue           | status            | string    | Status of the Jira issue creation. Can be "COMPLETED" if the Jira issue was created successfully, or "FAILED" if the Jira issue creation failed.       |
| attributes           | key               | string    | Key of the case.                                                                                                                                       |
| attributes           | linear_issue      | object    | Linear issue associated with the case.                                                                                                                 |
| linear_issue         | error_message     | string    | Error message if the Linear issue creation failed.                                                                                                     |
| linear_issue         | result            | object    | Result of the Linear issue creation.                                                                                                                   |
| result               | account_id        | string    | Account ID of the Linear workspace.                                                                                                                    |
| result               | issue_id          | string    | Unique identifier of the Linear issue.                                                                                                                 |
| result               | issue_key         | string    | Key of the Linear issue.                                                                                                                               |
| result               | team_id           | string    | Team ID of the Linear issue.                                                                                                                           |
| result               | url               | string    | URL of the Linear issue.                                                                                                                               |
| linear_issue         | status            | string    | Status of the Linear issue creation. Can be "COMPLETED" if the Linear issue was created successfully, or "FAILED" if the Linear issue creation failed. |
| attributes           | modified_at       | date-time | Timestamp of when the case was last modified.                                                                                                          |
| attributes           | priority          | string    | Priority of the case.                                                                                                                                  |
| attributes           | servicenow_ticket | object    | ServiceNow ticket associated with the case.                                                                                                            |
| servicenow_ticket    | result            | object    | Result of the ServiceNow ticket creation or attachment.                                                                                                |
| result               | instance_name     | string    | ServiceNow instance name extracted from the ticket URL.                                                                                                |
| result               | sys_id            | string    | Unique identifier of the ServiceNow incident record.                                                                                                   |
| result               | sys_target_link   | string    | Direct link to the ServiceNow incident record.                                                                                                         |
| result               | sys_target_sys_id | string    | Unique identifier of the target ServiceNow record.                                                                                                     |
| result               | table_name        | string    | ServiceNow table containing the incident record.                                                                                                       |
| result               | url               | string    | URL of the ServiceNow incident record.                                                                                                                 |
| servicenow_ticket    | status            | string    | Status of the ServiceNow ticket operation. Can be "COMPLETED" if successful, or "FAILED" if the operation failed.                                      |
| attributes           | status            | string    | Status of the case.                                                                                                                                    |
| attributes           | status_group      | string    | Status group of the case.                                                                                                                              |
| attributes           | status_name       | string    | Status name of the case.                                                                                                                               |
| attributes           | title             | string    | Title of the case.                                                                                                                                     |
| attributes           | type              | string    | Type of the case. For security cases, this is always "SECURITY".                                                                                       |
| data                 | id                | string    | Unique identifier of the case.                                                                                                                         |
| data                 | relationships     | object    | Relationships of the case.                                                                                                                             |
| relationships        | created_by        | object    | User who created the case.                                                                                                                             |
| created_by           | data [*required*] | object    | Relationship to user object.                                                                                                                           |
| data                 | id [*required*]   | string    | A unique identifier that represents the user.                                                                                                          |
| data                 | type [*required*] | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                   |
| relationships        | modified_by       | object    | User who last modified the case.                                                                                                                       |
| modified_by          | data [*required*] | object    | Relationship to user object.                                                                                                                           |
| data                 | id [*required*]   | string    | A unique identifier that represents the user.                                                                                                          |
| data                 | type [*required*] | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                   |
| relationships        | project           | object    | Project in which the case was created.                                                                                                                 |
| project              | data [*required*] | object    | Data object representing a case management project.                                                                                                    |
| data                 | id [*required*]   | string    | Unique identifier of the case management project.                                                                                                      |
| data                 | type [*required*] | enum      | Projects resource type. Allowed enum values: `projects`. Default: `projects`.                                                                          |
| data                 | type [*required*] | enum      | Cases resource type. Allowed enum values: `cases`. Default: `cases`.                                                                                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "archived_at": "2025-01-01T00:00:00.000Z",
        "assigned_to": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "attributes": {
          "<any-key>": []
        },
        "closed_at": "2025-01-01T00:00:00.000Z",
        "created_at": "2025-01-01T00:00:00.000Z",
        "creation_source": "CS_SECURITY_FINDING",
        "description": "A description of the case.",
        "due_date": "2025-01-01",
        "insights": [
          {
            "ref": "/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static",
            "resource_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
            "type": "SECURITY_FINDING"
          }
        ],
        "jira_issue": {
          "error_message": "{\"errorMessages\":[\"An error occured.\"],\"errors\":{}}",
          "result": {
            "account_id": "463a8631-680e-455c-bfd3-3ed04d326eb7",
            "issue_id": "2871276",
            "issue_key": "PROJ-123",
            "issue_url": "https://domain.atlassian.net/browse/PROJ-123"
          },
          "status": "COMPLETED"
        },
        "key": "PROJ-123",
        "linear_issue": {
          "error_message": "Linear issue creation failed.",
          "result": {
            "account_id": "463a8631-680e-455c-bfd3-3ed04d326eb7",
            "issue_id": "9c1e5f8a-2b3d-4c7e-8f6a-1d2e3f4a5b6c",
            "issue_key": "ENG-123",
            "team_id": "b5d3c8a1-7e6f-4d2c-9a8b-3c4d5e6f7a8b",
            "url": "https://linear.app/your-workspace/issue/ENG-123"
          },
          "status": "COMPLETED"
        },
        "modified_at": "2025-01-01T00:00:00.000Z",
        "priority": "P4",
        "servicenow_ticket": {
          "result": {
            "instance_name": "example",
            "sys_id": "abcdef0123456789abcdef0123456789",
            "sys_target_link": "https://example.service-now.com/incident.do?sys_id=abcdef0123456789abcdef0123456789",
            "sys_target_sys_id": "abcdef0123456789abcdef0123456789",
            "table_name": "incident",
            "url": "https://example.service-now.com/now/nav/ui/classic/params/target/incident.do?sys_id=abcdef0123456789abcdef0123456789"
          },
          "status": "COMPLETED"
        },
        "status": "OPEN",
        "status_group": "SG_OPEN",
        "status_name": "Open",
        "title": "A title for the case.",
        "type": "SECURITY"
      },
      "id": "c1234567-89ab-cdef-0123-456789abcdef",
      "relationships": {
        "created_by": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "modified_by": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "project": {
          "data": {
            "id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
            "type": "projects"
          }
        }
      },
      "type": "cases"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/security/findings/linear_issues" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
        "description": "A description of the Linear issue.",
        "label_ids": [
          "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"
        ],
        "linear_project_id": "d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d",
        "priority": "NOT_DEFINED",
        "title": "A title for the Linear issue."
      },
      "relationships": {
        "findings": {
          "data": [
            {
              "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
              "type": "findings"
            }
          ]
        },
        "project": {
          "data": {
            "id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
            "type": "projects"
          }
        }
      },
      "type": "linear_issues"
    }
  ]
}
EOF
```
{% /tab %}

{% tab label="Go" %}
```go
// Create Linear issues for security findings returns "Created" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.CreateLinearIssueRequestArray{
		Data: []datadogV2.CreateLinearIssueRequestData{
			{
				Attributes: &datadogV2.CreateLinearIssueRequestDataAttributes{
					AssigneeId:  datadog.PtrString("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"),
					Description: datadog.PtrString("A description of the Linear issue."),
					LabelIds: []string{
						"a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
					},
					LinearProjectId: datadog.PtrString("d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d"),
					Priority:        datadogV2.CASEPRIORITY_NOT_DEFINED.Ptr(),
					Title:           datadog.PtrString("A title for the Linear issue."),
				},
				Relationships: &datadogV2.CreateLinearIssueRequestDataRelationships{
					Findings: datadogV2.Findings{
						Data: []datadogV2.FindingData{
							{
								Id:   "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
								Type: datadogV2.FINDINGDATATYPE_FINDINGS,
							},
						},
					},
					Project: datadogV2.CaseManagementProject{
						Data: datadogV2.CaseManagementProjectData{
							Id:   "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
							Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS,
						},
					},
				},
				Type: datadogV2.LINEARISSUESDATATYPE_LINEAR_ISSUES,
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSecurityMonitoringApi(apiClient)
	resp, r, err := api.CreateLinearIssues(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateLinearIssues`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateLinearIssues`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Create Linear issues for security findings returns "Created" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.CaseManagementProject;
import com.datadog.api.client.v2.model.CaseManagementProjectData;
import com.datadog.api.client.v2.model.CaseManagementProjectDataType;
import com.datadog.api.client.v2.model.CasePriority;
import com.datadog.api.client.v2.model.CreateLinearIssueRequestArray;
import com.datadog.api.client.v2.model.CreateLinearIssueRequestData;
import com.datadog.api.client.v2.model.CreateLinearIssueRequestDataAttributes;
import com.datadog.api.client.v2.model.CreateLinearIssueRequestDataRelationships;
import com.datadog.api.client.v2.model.FindingCaseResponseArray;
import com.datadog.api.client.v2.model.FindingData;
import com.datadog.api.client.v2.model.FindingDataType;
import com.datadog.api.client.v2.model.Findings;
import com.datadog.api.client.v2.model.LinearIssuesDataType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

    CreateLinearIssueRequestArray body =
        new CreateLinearIssueRequestArray()
            .data(
                Collections.singletonList(
                    new CreateLinearIssueRequestData()
                        .attributes(
                            new CreateLinearIssueRequestDataAttributes()
                                .assigneeId("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0")
                                .description("A description of the Linear issue.")
                                .labelIds(
                                    Collections.singletonList(
                                        "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"))
                                .linearProjectId("d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d")
                                .priority(CasePriority.NOT_DEFINED)
                                .title("A title for the Linear issue."))
                        .relationships(
                            new CreateLinearIssueRequestDataRelationships()
                                .findings(
                                    new Findings()
                                        .data(
                                            Collections.singletonList(
                                                new FindingData()
                                                    .id(
                                                        "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==")
                                                    .type(FindingDataType.FINDINGS))))
                                .project(
                                    new CaseManagementProject()
                                        .data(
                                            new CaseManagementProjectData()
                                                .id("aeadc05e-98a8-11ec-ac2c-da7ad0900001")
                                                .type(CaseManagementProjectDataType.PROJECTS))))
                        .type(LinearIssuesDataType.LINEAR_ISSUES)));

    try {
      FindingCaseResponseArray result = apiInstance.createLinearIssues(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SecurityMonitoringApi#createLinearIssues");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Create Linear issues for security findings returns "Created" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.case_management_project import CaseManagementProject
from datadog_api_client.v2.model.case_management_project_data import CaseManagementProjectData
from datadog_api_client.v2.model.case_management_project_data_type import CaseManagementProjectDataType
from datadog_api_client.v2.model.case_priority import CasePriority
from datadog_api_client.v2.model.create_linear_issue_request_array import CreateLinearIssueRequestArray
from datadog_api_client.v2.model.create_linear_issue_request_data import CreateLinearIssueRequestData
from datadog_api_client.v2.model.create_linear_issue_request_data_attributes import (
    CreateLinearIssueRequestDataAttributes,
)
from datadog_api_client.v2.model.create_linear_issue_request_data_relationships import (
    CreateLinearIssueRequestDataRelationships,
)
from datadog_api_client.v2.model.finding_data import FindingData
from datadog_api_client.v2.model.finding_data_type import FindingDataType
from datadog_api_client.v2.model.findings import Findings
from datadog_api_client.v2.model.linear_issues_data_type import LinearIssuesDataType

body = CreateLinearIssueRequestArray(
    data=[
        CreateLinearIssueRequestData(
            attributes=CreateLinearIssueRequestDataAttributes(
                assignee_id="f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
                description="A description of the Linear issue.",
                label_ids=[
                    "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
                ],
                linear_project_id="d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d",
                priority=CasePriority.NOT_DEFINED,
                title="A title for the Linear issue.",
            ),
            relationships=CreateLinearIssueRequestDataRelationships(
                findings=Findings(
                    data=[
                        FindingData(
                            id="ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                            type=FindingDataType.FINDINGS,
                        ),
                    ],
                ),
                project=CaseManagementProject(
                    data=CaseManagementProjectData(
                        id="aeadc05e-98a8-11ec-ac2c-da7ad0900001",
                        type=CaseManagementProjectDataType.PROJECTS,
                    ),
                ),
            ),
            type=LinearIssuesDataType.LINEAR_ISSUES,
        ),
    ],
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = SecurityMonitoringApi(api_client)
    response = api_instance.create_linear_issues(body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Create Linear issues for security findings returns "Created" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new

body = DatadogAPIClient::V2::CreateLinearIssueRequestArray.new({
  data: [
    DatadogAPIClient::V2::CreateLinearIssueRequestData.new({
      attributes: DatadogAPIClient::V2::CreateLinearIssueRequestDataAttributes.new({
        assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
        description: "A description of the Linear issue.",
        label_ids: [
          "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
        ],
        linear_project_id: "d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d",
        priority: DatadogAPIClient::V2::CasePriority::NOT_DEFINED,
        title: "A title for the Linear issue.",
      }),
      relationships: DatadogAPIClient::V2::CreateLinearIssueRequestDataRelationships.new({
        findings: DatadogAPIClient::V2::Findings.new({
          data: [
            DatadogAPIClient::V2::FindingData.new({
              id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
              type: DatadogAPIClient::V2::FindingDataType::FINDINGS,
            }),
          ],
        }),
        project: DatadogAPIClient::V2::CaseManagementProject.new({
          data: DatadogAPIClient::V2::CaseManagementProjectData.new({
            id: "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
            type: DatadogAPIClient::V2::CaseManagementProjectDataType::PROJECTS,
          }),
        }),
      }),
      type: DatadogAPIClient::V2::LinearIssuesDataType::LINEAR_ISSUES,
    }),
  ],
})
p api_instance.create_linear_issues(body)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Create Linear issues for security findings returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::CaseManagementProject;
use datadog_api_client::datadogV2::model::CaseManagementProjectData;
use datadog_api_client::datadogV2::model::CaseManagementProjectDataType;
use datadog_api_client::datadogV2::model::CasePriority;
use datadog_api_client::datadogV2::model::CreateLinearIssueRequestArray;
use datadog_api_client::datadogV2::model::CreateLinearIssueRequestData;
use datadog_api_client::datadogV2::model::CreateLinearIssueRequestDataAttributes;
use datadog_api_client::datadogV2::model::CreateLinearIssueRequestDataRelationships;
use datadog_api_client::datadogV2::model::FindingData;
use datadog_api_client::datadogV2::model::FindingDataType;
use datadog_api_client::datadogV2::model::Findings;
use datadog_api_client::datadogV2::model::LinearIssuesDataType;

#[tokio::main]
async fn main() {
    let body = CreateLinearIssueRequestArray::new(vec![CreateLinearIssueRequestData::new(
        LinearIssuesDataType::LINEAR_ISSUES,
    )
    .attributes(
        CreateLinearIssueRequestDataAttributes::new()
            .assignee_id("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0".to_string())
            .description("A description of the Linear issue.".to_string())
            .label_ids(vec!["a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d".to_string()])
            .linear_project_id("d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d".to_string())
            .priority(CasePriority::NOT_DEFINED)
            .title("A title for the Linear issue.".to_string()),
    )
    .relationships(CreateLinearIssueRequestDataRelationships::new(
        Findings::new().data(vec![FindingData::new(
            "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==".to_string(),
            FindingDataType::FINDINGS,
        )]),
        CaseManagementProject::new(CaseManagementProjectData::new(
            "aeadc05e-98a8-11ec-ac2c-da7ad0900001".to_string(),
            CaseManagementProjectDataType::PROJECTS,
        )),
    ))]);
    let configuration = datadog::Configuration::new();
    let api = SecurityMonitoringAPI::with_config(configuration);
    let resp = api.create_linear_issues(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Create Linear issues for security findings returns "Created" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.SecurityMonitoringApi(configuration);

const params: v2.SecurityMonitoringApiCreateLinearIssuesRequest = {
  body: {
    data: [
      {
        attributes: {
          assigneeId: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
          description: "A description of the Linear issue.",
          labelIds: ["a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d"],
          linearProjectId: "d4c3b2a1-6f5e-8b7a-0d9c-2f1e4a3b6c5d",
          priority: "NOT_DEFINED",
          title: "A title for the Linear issue.",
        },
        relationships: {
          findings: {
            data: [
              {
                id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                type: "findings",
              },
            ],
          },
          project: {
            data: {
              id: "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
              type: "projects",
            },
          },
        },
        type: "linear_issues",
      },
    ],
  },
};

apiInstance
  .createLinearIssues(params)
  .then((data: v2.FindingCaseResponseArray) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
