Skip to content

Invoke KNRequest

Alexander Ryzhov edited this page Mar 17, 2021 · 3 revisions

Invoke-KNRequest

SYNOPSIS

POST/GET/DELETE requests to Keenetic REST API

SYNTAX

Invoke-KNRequest [-Ci] [-Method <String>] [[-URL] <String>] [[-Body] <String>] [-OutFile <String>] [-Raw]
 [-Headers <IDictionary>] [-Session <KNSession>] [<CommonParameters>]

DESCRIPTION

This is a prototype for any other requests exposed from module.

EXAMPLES

ПРИМЕР 1

Invoke-KNRequest show/version -Session $Session

Return a JSON response from 'show version' CLI command in active $session.

ПРИМЕР 2

Invoke-KNRequest 'firmware' -Ci -OutFile fw_backup.bin -Raw

Download firmware via deprecated XML Core Interface (ci). Function will raise an exception if default session is not defined.

PARAMETERS

-Ci

Use deprecated 'ci' XML Core Interface. Otherwise, REST Core Interface 'rci' wil be used (by default).

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Method

Request method. Post/Get/Delete methods allowed. 'Get' by default.

Type: String
Parameter Sets: (All)
Aliases:

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

-URL

URL, i.e. 'show/version'

Type: String
Parameter Sets: (All)
Aliases:

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

-Body

POST request body. Optional for 'rci', mandatory for 'ci'.

Type: String
Parameter Sets: (All)
Aliases:

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

-OutFile

Specifies the output file to save instead of returning it to pipe.

Type: String
Parameter Sets: (All)
Aliases:

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

-Raw

Don't try to interpret Keentic response as JSON/XML.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Headers

Request headers

Type: IDictionary
Parameter Sets: (All)
Aliases:

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

-Session

Existing connection session. Default session used if parameter omitted.

Type: KNSession
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $Global:DefaultKNSession
Accept pipeline input: True (ByValue)
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

RELATED LINKS

http://docs.help.keenetic.com/cli/3.1/en/cli_manual_kn-1010.pdf