Webhook Tests

A WebhookTest is an object that can be sent to your Webhook endpoint for connection and response tests.

Create Webhook Test

SDK Method

webhooktest.Create()

Return Object

WebhookTest

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Folder Admin permissions.

WebhookTestCreateParams Fields

FieldDescription
Url
string
Required
URL for testing the webhook.
Method
string
HTTP method(GET or POST).
Encoding
string
HTTP encoding method. Can be JSON, XML, or RAW (form data).
Headers
object
Additional request headers.
Body
object
Additional body parameters.
RawBody
string
raw body text
FileAsBody
boolean
Send the file data as the request body?
FileFormField
string
Send the file data as a named parameter in the request POST body
UseDedicatedIps
boolean
Use dedicated IPs for sending the webhook?

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    webhook_test "github.com/Files-com/files-sdk-go/v3/webhooktest"
)

webhookTest, err := webhook_test.Create(files_sdk.WebhookTestCreateParams{Url: "https://www.site.com/..."})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The WebhookTest Object

Some of the methods above return a WebhookTest object. The attributes of this object are listed below.

AttributeDescription
Code
int64
Status HTTP code
Message
string
Error message
Status
string
Status message
Data
Auto
Additional data
Success
boolean
The success status of the webhook test