# Webforms

## Overview

### Available Operations

* [getAll](#getall) - Get All Webforms
* [create](#create) - Create Webform
* [update](#update) - Update Webform
* [remove](#remove) - Remove Webform
* [getById](#getbyid) - Get Webform By ID

## getAll

Returns all webforms of the given `owner_id` (teamId) in the request param. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### 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.webforms.getAll({
    ownerId: "<id>",
  });

  for await (const page of result) {
    console.log(page);
  }
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { webformsGetAll } from "@solarwinds/squadcast-sdk-typescript/funcs/webformsGetAll.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 webformsGetAll(squadcastSDK, {
    ownerId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    for await (const page of result) {
    console.log(page);
  }
  } else {
    console.log("webformsGetAll failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                            | Required             | Description                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.WebformsGetAllWebformsRequest](/typescript/docs/models/operations/webformsgetallwebformsrequest.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](/typescript/docs/lib/utils/retryconfig.md)                                                        | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.WebformsGetAllWebformsResponse**](/typescript/docs/models/operations/webformsgetallwebformsresponse.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

Add a webform to the organization. Returns the webform object in response. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### 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.webforms.create({
    ownerId: "<id>",
    name: "<value>",
    isCname: false,
    isCaptchaEnabled: false,
    captchaSecret: {
      siteKey: "<value>",
      secret: "<value>",
    },
    formOwnerType: "<value>",
    formOwnerId: "<id>",
    services: [],
    header: "<value>",
    title: "<value>",
    footerText: "<value>",
    footerLink: "<value>",
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { webformsCreate } from "@solarwinds/squadcast-sdk-typescript/funcs/webformsCreate.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 webformsCreate(squadcastSDK, {
    ownerId: "<id>",
    name: "<value>",
    isCname: false,
    isCaptchaEnabled: false,
    captchaSecret: {
      siteKey: "<value>",
      secret: "<value>",
    },
    formOwnerType: "<value>",
    formOwnerId: "<id>",
    services: [],
    header: "<value>",
    title: "<value>",
    footerText: "<value>",
    footerLink: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webformsCreate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                               | Required             | Description                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.V3WebformsCreateOrUpdateWebformRequest](/typescript/docs/models/v3webformscreateorupdatewebformrequest.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](/typescript/docs/lib/utils/retryconfig.md)                                                           | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.WebformsCreateWebformResponse**](/typescript/docs/models/operations/webformscreatewebformresponse.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    | \*/\*            |

## update

Update a webform to the organization. Returns the webform object in response. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### 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.webforms.update({
    webformId: 926692,
    v3WebformsCreateOrUpdateWebformRequest: {
      ownerId: "<id>",
      name: "<value>",
      isCname: true,
      isCaptchaEnabled: true,
      captchaSecret: {
        siteKey: "<value>",
        secret: "<value>",
      },
      formOwnerType: "<value>",
      formOwnerId: "<id>",
      services: [
        {
          serviceId: "<id>",
          name: "<value>",
          alias: "<value>",
        },
      ],
      header: "<value>",
      title: "<value>",
      footerText: "<value>",
      footerLink: "<value>",
    },
  });

  console.log(result);
}

run();
```

### Standalone function

The standalone function version of this method:

```typescript
import { SquadcastSDKCore } from "@solarwinds/squadcast-sdk-typescript/core.js";
import { webformsUpdate } from "@solarwinds/squadcast-sdk-typescript/funcs/webformsUpdate.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 webformsUpdate(squadcastSDK, {
    webformId: 926692,
    v3WebformsCreateOrUpdateWebformRequest: {
      ownerId: "<id>",
      name: "<value>",
      isCname: true,
      isCaptchaEnabled: true,
      captchaSecret: {
        siteKey: "<value>",
        secret: "<value>",
      },
      formOwnerType: "<value>",
      formOwnerId: "<id>",
      services: [
        {
          serviceId: "<id>",
          name: "<value>",
          alias: "<value>",
        },
      ],
      header: "<value>",
      title: "<value>",
      footerText: "<value>",
      footerLink: "<value>",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webformsUpdate failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                          | Required             | Description                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.WebformsUpdateWebformRequest](/typescript/docs/models/operations/webformsupdatewebformrequest.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](/typescript/docs/lib/utils/retryconfig.md)                                                      | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.WebformsUpdateWebformResponse**](/typescript/docs/models/operations/webformsupdatewebformresponse.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    | \*/\*            |

## remove

Remove a webform from the organization. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `user-write` scope.

### 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.webforms.remove({
    webformId: 842504,
    ownerId: "<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 { webformsRemove } from "@solarwinds/squadcast-sdk-typescript/funcs/webformsRemove.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 webformsRemove(squadcastSDK, {
    webformId: 842504,
    ownerId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webformsRemove failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                          | Required             | Description                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.WebformsRemoveWebformRequest](/typescript/docs/models/operations/webformsremovewebformrequest.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](/typescript/docs/lib/utils/retryconfig.md)                                                      | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.WebformsRemoveWebformResponse**](/typescript/docs/models/operations/webformsremovewebformresponse.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    | \*/\*            |

## getById

Returns a webform details of the given `webformId` in the request param. Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope.

### 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.webforms.getById({
    webformId: 831002,
    ownerId: "<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 { webformsGetById } from "@solarwinds/squadcast-sdk-typescript/funcs/webformsGetById.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 webformsGetById(squadcastSDK, {
    webformId: 831002,
    ownerId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webformsGetById failed:", res.error);
  }
}

run();
```

### Parameters

| Parameter              | Type                                                                                                            | Required             | Description                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.WebformsGetWebformByIdRequest](/typescript/docs/models/operations/webformsgetwebformbyidrequest.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](/typescript/docs/lib/utils/retryconfig.md)                                                        | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

### Response

**Promise<**[**operations.WebformsGetWebformByIdResponse**](/typescript/docs/models/operations/webformsgetwebformbyidresponse.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    | \*/\*            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.incidents.cloud.solarwinds.com/typescript/docs/sdks/webforms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
