> For the complete documentation index, see [llms.txt](https://developers.incidents.cloud.solarwinds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.incidents.cloud.solarwinds.com/typescript/docs/sdks/incidentspostmortems.md).

# Incidents.Postmortems

## Overview

### Available Operations

* [getAll](#getall) - Get All Postmortems
* [getByIncident](#getbyincident) - Get Postmortem By Incident
* [create](#create) - Create Postmortem

## getAll

* This endpoint is used to get all postmortems.
* Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header.

### Example Usage

```typescript
import { SquadcastSDK } from "@solarwinds/squadcast-sdk-typescript";

const squadcastSDK = new SquadcastSDK({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const result = await squadcastSDK.incidents.postmortems.getAll({
    fromDate: "<value>",
    toDate: "<value>",
    ownerId: "<id>",
    limit: 221553,
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { incidentsPostmortemsGetAll } from "@solarwinds/squadcast-sdk-typescript/funcs/incidentsPostmortemsGetAll.js";

// Use `SquadcastSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const squadcastSDK = new SquadcastSDKCore({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const res = await incidentsPostmortemsGetAll(squadcastSDK, {
    fromDate: "<value>",
    toDate: "<value>",
    ownerId: "<id>",
    limit: 221553,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("incidentsPostmortemsGetAll failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                                                                                         | Required             | Description                                                                                                                                                                    |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.PostmortemsGetAllPostmortemsRequest](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemsgetallpostmortemsrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                                               | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                      | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://developers.incidents.cloud.solarwinds.com/typescript/docs/lib/utils/retryconfig.md)                                                                    | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.PostmortemsGetAllPostmortemsResponse**](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemsgetallpostmortemsresponse.md)**>**

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## getByIncident

* This endpoint is used to get a postmortem by incident.
* Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header.

### Example Usage

```typescript
import { SquadcastSDK } from "@solarwinds/squadcast-sdk-typescript";

const squadcastSDK = new SquadcastSDK({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const result = await squadcastSDK.incidents.postmortems.getByIncident({
    incidentID: "<id>",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { incidentsPostmortemsGetByIncident } from "@solarwinds/squadcast-sdk-typescript/funcs/incidentsPostmortemsGetByIncident.js";

// Use `SquadcastSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const squadcastSDK = new SquadcastSDKCore({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const res = await incidentsPostmortemsGetByIncident(squadcastSDK, {
    incidentID: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("incidentsPostmortemsGetByIncident failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                                                                                                     | Required             | Description                                                                                                                                                                    |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.PostmortemsGetPostmortemByIncidentRequest](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemsgetpostmortembyincidentrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                                                           | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                                  | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://developers.incidents.cloud.solarwinds.com/typescript/docs/lib/utils/retryconfig.md)                                                                                | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.PostmortemsGetPostmortemByIncidentResponse**](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemsgetpostmortembyincidentresponse.md)**>**

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |

## create

* This endpoint is used to create a postmortem.
* Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header.

### Example Usage

```typescript
import { SquadcastSDK } from "@solarwinds/squadcast-sdk-typescript";

const squadcastSDK = new SquadcastSDK({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const result = await squadcastSDK.incidents.postmortems.create({
    incidentID: "<id>",
    v3IncidentsPostmortemsCreatePostmortemRequest: {
      ownerId: "<id>",
      title: "<value>",
      postmortem: "<value>",
      status: "published",
      followUps: [],
      attachments: [
        {},
      ],
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { incidentsPostmortemsCreate } from "@solarwinds/squadcast-sdk-typescript/funcs/incidentsPostmortemsCreate.js";

// Use `SquadcastSDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const squadcastSDK = new SquadcastSDKCore({
  refreshTokenAuth: "<YOUR_REFRESH_TOKEN_AUTH_HERE>",
});

async function run() {
  const res = await incidentsPostmortemsCreate(squadcastSDK, {
    incidentID: "<id>",
    v3IncidentsPostmortemsCreatePostmortemRequest: {
      ownerId: "<id>",
      title: "<value>",
      postmortem: "<value>",
      status: "published",
      followUps: [],
      attachments: [
        {},
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("incidentsPostmortemsCreate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                                                                                       | Required             | Description                                                                                                                                                                    |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.PostmortemsCreatePostmortemRequest](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemscreatepostmortemrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                                             | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                    | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://developers.incidents.cloud.solarwinds.com/typescript/docs/lib/utils/retryconfig.md)                                                                  | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.PostmortemsCreatePostmortemResponse**](https://developers.incidents.cloud.solarwinds.com/typescript/docs/models/operations/postmortemscreatepostmortemresponse.md)**>**

### Errors

| Error Type                      | Status Code | Content Type     |
| ------------------------------- | ----------- | ---------------- |
| errors.BadRequestError          | 400         | application/json |
| errors.UnauthorizedError        | 401         | application/json |
| errors.PaymentRequiredError     | 402         | application/json |
| errors.ForbiddenError           | 403         | application/json |
| errors.NotFoundError            | 404         | application/json |
| errors.ConflictError            | 409         | application/json |
| errors.UnprocessableEntityError | 422         | application/json |
| errors.InternalServerError      | 500         | application/json |
| errors.BadGatewayError          | 502         | application/json |
| errors.ServiceUnavailableError  | 503         | application/json |
| errors.GatewayTimeoutError      | 504         | application/json |
| errors.SDKDefaultError          | 4XX, 5XX    | \*/\*            |
