Skip to content

Send-NBBulkRequest

Since

v4.4.10.0

SYNOPSIS

Sends bulk requests to the Netbox API.

SYNTAX

Send-NBBulkRequest [-URI] <UriBuilder> [-Items] <Array> [-Method] <String> [[-BatchSize] <Int32>] [[-MaxItems] <Int32>] [-ShowProgress] [[-ActivityName] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Helper function for bulk API operations. Handles batching, progress reporting, and partial failure handling for POST, PATCH, and DELETE operations.

If a batch fails with a 500 Internal Server Error (which can occur due to Redis cache inconsistency when referencing newly created objects), the function automatically falls back to sequential single-item requests for that batch.

EXAMPLES

EXAMPLE 1

$result = Send-NBBulkRequest -URI $uri -Items $devices -Method POST -BatchSize 50

PARAMETERS

-URI

The base URI for the API endpoint.

```yaml Type: UriBuilder Parameter Sets: (All) Aliases:

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

-Items

Array of items to process in bulk.

```yaml Type: Array Parameter Sets: (All) Aliases:

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

-Method

HTTP method (POST, PATCH, DELETE).

```yaml Type: String Parameter Sets: (All) Aliases:

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

-BatchSize

Maximum number of items per API request. Default: 100, Max: 1000.

```yaml Type: Int32 Parameter Sets: (All) Aliases:

Required: False Position: 4 Default value: 100 Accept pipeline input: False Accept wildcard characters: False ```

-MaxItems

{{ Fill MaxItems Description }}

```yaml Type: Int32 Parameter Sets: (All) Aliases:

Required: False Position: 5 Default value: 10000 Accept pipeline input: False Accept wildcard characters: False ```

-ShowProgress

Show progress bar during bulk operations.

```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:

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

-ActivityName

Name to display in the progress bar.

```yaml Type: String Parameter Sets: (All) Aliases:

Required: False Position: 6 Default value: Bulk operation Accept pipeline input: False Accept wildcard characters: False ```

-ProgressAction

{{ Fill ProgressAction Description }}

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

Required: False 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

[BulkOperationResult] Object containing succeeded and failed items.

NOTES

AddedInVersion: v4.4.10.0

Common parameters

common request params