> 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/go-sdk/docs/sdks/webforms.md).

# Webforms

## Overview

### Available Operations

* [GetAll](#getall) - Get All Webforms
* [Create](#create) - Create Webform
* [Update](#update) - Update Webform
* [Remove](#remove) - Remove Webform
* [Get](#get) - 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

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Webforms.GetAll(ctx, "<id>", nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
```

### Parameters

| Parameter    | Type                                                                                                              | Required             | Description                         |
| ------------ | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`        | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `ownerID`    | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `pageNumber` | `*int64`                                                                                                          | :heavy\_minus\_sign: | N/A                                 |
| `pageSize`   | `*int64`                                                                                                          | :heavy\_minus\_sign: | N/A                                 |
| `opts`       | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WebformsGetAllWebformsResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/webformsgetallwebformsresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 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

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Webforms.Create(ctx, components.V3WebformsCreateOrUpdateWebformRequest{
        OwnerID: "<id>",
        Name: "<value>",
        IsCname: false,
        IsCaptchaEnabled: false,
        CaptchaSecret: components.V3WebformsRecaptchaSecrets{
            SiteKey: "<value>",
            Secret: "<value>",
        },
        FormOwnerType: "<value>",
        FormOwnerID: "<id>",
        Services: []components.V3WebformsWFService{},
        Header: "<value>",
        Title: "<value>",
        FooterText: "<value>",
        FooterLink: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter | Type                                                                                                                                                                           | Required             | Description                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------------------------------ |
| `ctx`     | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                          | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [components.V3WebformsCreateOrUpdateWebformRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3webformscreateorupdatewebformrequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                              | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.WebformsCreateWebformResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/webformscreatewebformresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 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

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Webforms.Update(ctx, 926692, components.V3WebformsCreateOrUpdateWebformRequest{
        OwnerID: "<id>",
        Name: "<value>",
        IsCname: true,
        IsCaptchaEnabled: true,
        CaptchaSecret: components.V3WebformsRecaptchaSecrets{
            SiteKey: "<value>",
            Secret: "<value>",
        },
        FormOwnerType: "<value>",
        FormOwnerID: "<id>",
        Services: []components.V3WebformsWFService{
            components.V3WebformsWFService{
                ServiceID: "<id>",
                Name: "<value>",
                Alias: "<value>",
            },
        },
        Header: "<value>",
        Title: "<value>",
        FooterText: "<value>",
        FooterLink: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter                                | Type                                                                                                                                                                           | Required             | Description                         |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ----------------------------------- |
| `ctx`                                    | [context.Context](https://pkg.go.dev/context#Context)                                                                                                                          | :heavy\_check\_mark: | The context to use for the request. |
| `webformID`                              | `int64`                                                                                                                                                                        | :heavy\_check\_mark: | N/A                                 |
| `v3WebformsCreateOrUpdateWebformRequest` | [components.V3WebformsCreateOrUpdateWebformRequest](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/components/v3webformscreateorupdatewebformrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                                   | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md)                                                              | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WebformsUpdateWebformResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/webformsupdatewebformresponse.md)**, error**

### Errors

| Error Type                         | Status Code | Content Type     |
| ---------------------------------- | ----------- | ---------------- |
| apierrors.BadRequestError          | 400         | application/json |
| apierrors.UnauthorizedError        | 401         | application/json |
| apierrors.PaymentRequiredError     | 402         | application/json |
| apierrors.ForbiddenError           | 403         | application/json |
| apierrors.NotFoundError            | 404         | application/json |
| apierrors.ConflictError            | 409         | application/json |
| apierrors.UnprocessableEntityError | 422         | application/json |
| apierrors.InternalServerError      | 500         | application/json |
| apierrors.BadGatewayError          | 502         | application/json |
| apierrors.ServiceUnavailableError  | 503         | application/json |
| apierrors.GatewayTimeoutError      | 504         | application/json |
| apierrors.APIError                 | 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

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Webforms.Remove(ctx, 842504, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter   | Type                                                                                                              | Required             | Description                         |
| ----------- | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`       | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `webformID` | `int64`                                                                                                           | :heavy\_check\_mark: | N/A                                 |
| `ownerID`   | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`      | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WebformsRemoveWebformResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/webformsremovewebformresponse.md)**, error**

### Errors

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

## Get

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

```go
package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Webforms.Get(ctx, 831002, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}
```

### Parameters

| Parameter   | Type                                                                                                              | Required             | Description                         |
| ----------- | ----------------------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
| `ctx`       | [context.Context](https://pkg.go.dev/context#Context)                                                             | :heavy\_check\_mark: | The context to use for the request. |
| `webformID` | `int64`                                                                                                           | :heavy\_check\_mark: | N/A                                 |
| `ownerID`   | `string`                                                                                                          | :heavy\_check\_mark: | N/A                                 |
| `opts`      | \[][operations.Option](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.WebformsGetWebformByIDResponse**](https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/models/operations/webformsgetwebformbyidresponse.md)**, error**

### Errors

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