Invoke BrevoCall - tsubotitsch/Brevo GitHub Wiki

Invoke-BrevoCall

SYNOPSIS

Makes API calls to the Brevo API.

SYNTAX

Invoke-BrevoCall -uri <String> [-method <Object>] [-body <Object>] [-limit <Object>] [-offset <Object>]
 [-returnobject <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

This function is used to interact with the Brevo API by making RESTful API calls. It supports various HTTP methods, handles pagination, and allows for flexible API interactions.

EXAMPLES

EXAMPLE 1

# Example: Retrieve a list of contacts with pagination
Invoke-BrevoCall -uri "/contacts" -method "GET" -limit 50 -offset 0

EXAMPLE 2

# Example: Create a new contact
$body = @{
    email = "[email protected]"
    attributes = @{
        FNAME = "John"
        LNAME = "Doe"
    }
    listIds = @(1, 2)
}
Invoke-BrevoCall -uri "/contacts" -method "POST" -body $body

PARAMETERS

-body

The request body for methods like POST or PUT. This should be a PowerShell object that will be converted to JSON.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-limit

The number of results returned per page. The default and maximum value may vary per API.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-method

The HTTP method to use for the API call. Supported methods are GET, POST, PUT, DELETE, and PATCH. Default: GET.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: GET
Accept pipeline input: False
Accept wildcard characters: False

-offset

The index of the first document in the page (starting with 0). For example, if the limit is 50 and you want to retrieve page 2, set offset to 50. Default: 0.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-returnobject

Specifies a specific object to return from the API response. If not specified, the full response will be returned.

Type: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-uri

The relative URI of the API endpoint. This should be relative to the base URI provided in Connect-Brevo.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

  • Requires the Connect-Brevo function to be called first to set up the base URI and API key.
  • Handles pagination automatically if the API response includes a "count" property.

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️