Connect-NBAPI
Since
v1.0.4
SYNOPSIS
Connects to the Netbox API and ensures Credential work properly
SYNTAX
Manual (Default)
Connect-NBAPI -Hostname <String> [-Credential <PSCredential>] [-Scheme <String>] [-Port <UInt16>]
[-SkipCertificateCheck] [-TimeoutSeconds <UInt16>] [-IgnoreCase] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
URI
Connect-NBAPI [-Credential <PSCredential>] -URI <String> [-SkipCertificateCheck] [-TimeoutSeconds <UInt16>]
[-IgnoreCase] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Connects to the Netbox API and ensures Credential work properly
EXAMPLES
EXAMPLE 1
Connect-NBAPI -Hostname "netbox.domain.com"
This will prompt for Credential, then proceed to attempt a connection to Netbox
EXAMPLE 2
Connect-NBAPI -Hostname "netbox.domain.com" -IgnoreCase
This will prompt for Credential, then proceed to attempt a connection to Netbox with case-insensitive query parameters enabled
PARAMETERS
-Hostname
The hostname for the resource such as netbox.domain.com
Type: String
Parameter Sets: Manual
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Credential
A PSCredential object. Put the API token in the Password field. The Username field is ignored.
Supports both token formats: - v1 (legacy): 40-character hex token, uses 'Token' auth header - v2 (4.5+): Starts with 'nbt_', uses 'Bearer' auth header
The correct auth header is automatically detected based on token format.
Example: $cred = [PSCredential]::new('api', (ConvertTo-SecureString 'your-api-token' -AsPlainText -Force))
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Scheme
Scheme for the URI such as HTTP or HTTPS. Defaults to HTTPS
Type: String
Parameter Sets: Manual
Aliases:
Required: False
Position: Named
Default value: Https
Accept pipeline input: False
Accept wildcard characters: False
-Port
Port for the resource. Value between 1-65535
Type: UInt16
Parameter Sets: Manual
Aliases:
Required: False
Position: Named
Default value: 443
Accept pipeline input: False
Accept wildcard characters: False
-URI
The full URI for the resource such as "https://netbox.domain.com:8443"
Type: String
Parameter Sets: URI
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SkipCertificateCheck
Skip SSL/TLS certificate validation. Use this for self-signed certificates or test environments. On PowerShell Core (7+), uses the native -SkipCertificateCheck parameter. On PowerShell Desktop (5.1), uses a custom certificate policy callback.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-TimeoutSeconds
The number of seconds before the HTTP call times out. Defaults to 30 seconds
Type: UInt16
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 30
Accept pipeline input: False
Accept wildcard characters: False
-IgnoreCase
When set, string query parameters are sent case-insensitively using Netbox's "__ie" lookup (e.g., ?name__ie=value). Only applies to parameters supported by the connected Netbox version, and only on endpoints where that lookup is available; unsupported fields stay case-sensitive. See Set-NBQueryOption for details.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
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
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
System.Management.Automation.PSObject
NOTES
AddedInVersion: v1.0.4