Akamai request
Invoke-AkamaiRequest
Synopsis
Sends a HTTPS request to an Akamai RESTful web service.
Syntax
Invoke-AkamaiRequest [-Path] <String> [[-Method] <String>] [[-QueryParameters] <Hashtable>] [[-AdditionalHeaders] <Hashtable>] [[-Body] <Object>] [[-InputFile] <String>] [[-OutputFile] <String>] [[-MaxBody] <String>] [-SkipHttpErrorCheck] [[-Retry] <Int32>] [[-EdgeRCFile] <String>] [[-Section] <String>] [[-AccountSwitchKey] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Description
The Invoke-Akamai RestMethod
cmdlet sends a HTTPS request to Akamai RESTful web services and formats the response based on data type.
When the REST endpoint returns multiple objects, the objects are received as an array.
If you pipe the output from Invoke-AkamaiRequest
to another command, it's sent as a single \[Object\[\]\]
object.
The contents of that array are not enumerated for the next command on the pipeline.
Examples
Invoke-AkamaiRequest -Method "GET" -Path "/path/to/api"
`GET` without query parameters.
Invoke-AkamaiRequest -Method "POST" -Path "/path/to/api" -Body @{"key" = @{"key2" = "value"; "key3" = "value"}}
Request: `POST` without query parameters and an inline body.
Response: The data returned is dependent upon the endpoint and varies.
Invoke-AkamaiRequest -Method "POST" -Path "/path/to/api" -InputFile "~./path/to/body.json"
Request: `POST` without query parameters and path to the JSON body containing the body of the call.
Response: The data returned is dependent upon the endpoint and varies.
Invoke-AkamaiRequest -Method "PUT" -Path "/path/to/api?withParams=true" -Body @{"key" = @{"key2" = "value"; "key3" = "value"}
Request: `PUT` with query parameters for an existing item and an inline body.
Response: The data returned is dependent upon the endpoint and varies.
Invoke-AkamaiRequest -Method "PATCH" -Path "/path/to/api?withParams=true" -Body '{"key":{"key3": "value"}}'
Request: `PATCH` with query parameters for an existing item and an inline body.
Response: The data returned is dependent upon the endpoint and varies.
Invoke-AkamaiRequest -Method "DELETE" -Path "/path/to/api?itemId"
Request: `DELETE` with an ID for the item to delete as a query parameter.
Response: The data returned is dependent upon the endpoint and varies.
Parameters
-Path
A resource's path minus the host.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Method
Specifies the method used for the web request.
Values are GET
, HEAD
, POST
, PUT
, DELETE
and PATCH
.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: GET
Accept pipeline input: False
Accept wildcard characters: False
-QueryParameters
A hashtable of request query parameters to add to request.
If the same key is found in Path
and QueryParameters
, the QueryParameters
value persists.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AdditionalHeaders
A hashtable of any additional request headers.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Body
The data sent to the endpoint. The value is a hashtable that includes values for each parameter.
Important: Because
Body
is a free field, our PowerShell module doesn't validate the data you include, the API does.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputFile
If needed by an endpoint, an input file's location.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OutputFile
If provided by an endpoint, where to place an output file.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-MaxBody
The maximum message body size. Default is 2048
bytes. Increase as needed up to 131072
bytes.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: 131072
Accept pipeline input: False
Accept wildcard characters: False
-SkipHttpErrorCheck
Switch to be passed through to Invoke-WebRequest in order to avoid status codes 300+ throwing an error.
Note: Only compatible with PowerShell versions ≥7.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Retry
Retry index. Used when handling error retries
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-EdgeRCFile
Your EdgeGrid resource file to authenticate your command. Defaults to ~/.edgerc
.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Section
The credential section of your EdgeGrid resource file to use with the function.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AccountSwitchKey
An account credential key that lets you move between accounts when using an API client enabled for multiple accounts. To find account switch keys, use Get-AccountSwitchKey.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Related Links
Updated 1 day ago