Public/Remove-VerkadaLicensePlateOfInterest.ps1
function Remove-VerkadaLicensePlateOfInterest{ <# .SYNOPSIS Deletes a License Plate of Interest for an organization using a license plate number. .DESCRIPTION This function uses the public api endpoint(https://api.verkada.com/cameras/v1/analytics/lpr/license_plate_of_interest) to delete a License Plate of Interest from the specified organization. The org_id and reqired tokens can be directly submitted as parameters, but is much easier to use Connect-Verkada to cache this information ahead of time and for subsequent commands. .LINK https://github.com/bepsoccer/verkadaModule/blob/master/docs/function-documentation/Remove-VerkadaLicensePlateOfInterest.md .EXAMPLE Remove-VerkadaLicensePlateOfInterest -license_plate 'ABC123' The org_id and tokens will be populated from the cached created by Connect-Verkada. .EXAMPLE Remove-VerkadaLPoI 'ABC123' The org_id and tokens will be populated from the cached created by Connect-Verkada. .EXAMPLE Import-CSV ./file_ofLicenses.csv | Remove-VerkadaLPoI The org_id and tokens will be populated from the cached created by Connect-Verkada. .EXAMPLE Remove-VerkadaLicensePlateOfInterest -license_plate 'ABC123' -org_id 'deds343-uuid-of-org' -x_api_key 'sd78ds-uuid-of-verkada-token' The org_id and tokens are submitted as parameters in the call. #> [CmdletBinding(PositionalBinding = $true)] [Alias("Remove-VerkadaLPoI")] param ( #The UUID of the organization the user belongs to [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateNotNullOrEmpty()] [ValidatePattern('^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$')] [String]$org_id = $Global:verkadaConnection.org_id, #The license plate number of the License Plate of Interest [Parameter(ValueFromPipelineByPropertyName = $true, Position = 0, Mandatory = $true)] [String]$license_plate, #The public API key to be used for calls that hit the public API gateway [Parameter(ValueFromPipelineByPropertyName = $true)] [ValidateNotNullOrEmpty()] [String]$x_api_key = $Global:verkadaConnection.token ) Begin { $url = "https://api.verkada.com/cameras/v1/analytics/lpr/license_plate_of_interest" #parameter validation if ([string]::IsNullOrEmpty($org_id)) {throw "org_id is missing but is required!"} if ([string]::IsNullOrEmpty($x_api_key)) {throw "x_api_key is missing but is required!"} } #end begin Process { $query_params = @{ 'license_plate' = $license_plate } try { $response = Invoke-VerkadaRestMethod $url $org_id $x_api_key $query_params -method delete return $response } catch [Microsoft.PowerShell.Commands.HttpResponseException] { $err = $_.ErrorDetails | ConvertFrom-Json $errorMes = $_ | Convertto-Json -WarningAction SilentlyContinue $err | Add-Member -NotePropertyName StatusCode -NotePropertyValue (($errorMes | ConvertFrom-Json -Depth 100 -WarningAction SilentlyContinue).Exception.Response.StatusCode) -Force throw "$($err.StatusCode) - $($err.message)" } } #end process End { } #end end } #end function |