Akamai REST method
Invoke-AkamaiRestMethod
Synopsis
Sends a HTTPS request to an Akamai RESTful web service.
Syntax
Invoke-AkamaiRestMethod [[-Method] <String>] [-Path] <String> [[-QueryParameters] <Hashtable>] [[-AdditionalHeaders] <Hashtable>] [[-Body] <Object>] [[-InputFile] <String>] [[-OutputFile] <String>] [[-MaxBody] <String>] [-IncludeResponseHeaders] [[-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-AkamaiRestMethod
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
-
GET
without query parameters.Invoke-AkamaiRestMethod -Method "GET" -Path "/path/to/api"
-
POST
without query parameters and an inline body.Invoke-AkamaiRestMethod -Method "POST" -Path "/path/to/api" -Body '{@{"key":{"key2": "value", "key3":"value"}}'
-
POST
without query parameters and path to the JSON body containing the body of the call.Invoke-AkamaiRestMethod -Method "POST" -Path "/path/to/api" -InputFile "~./path/to/body.json"
-
PUT
with query parameters for an existing item and an inline body.Invoke-AkamaiRestMethod -Method "PUT" -Path "/path/to/api?withParams=true" -Body '{@{"key":{"key2": "value", "key3":"value"}}'
-
PATCH
with query parameters for an existing item and an inline body.Invoke-AkamaiRestMethod -Method "PATCH" -Path "/path/to/api?withParams=true" -Body '{@{"key":{"key3": "value"}}'
-
DELETE
with an ID for the item to delete as a query parameter.Invoke-AkamaiRestMethod -Method "DELETE" -Path "/path/to/api?itemId"
Parameters
-Method
Specifies the method used for the web request.
Values are GET
, POST
, PUT
, DELETE
and PATCH
.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: GET
Accept pipeline input: False
Accept wildcard characters: False
-Path
A resource's path minus the host.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
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
-IncludeResponseHeaders
Flag to include headers in the function response
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-EdgeRCFile
The path to an edgerc file.
Defaults to ~/.edgerc
.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Section
The edgerc section name.
Defaults to default
.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AccountSwitchKey
A key used to apply changes to an account external to your credentials' account.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Related Links
PowerShell overview: https://techdocs.akamai.com/powershell/docs/overview
Online version: https://techdocs.akamai.com/powershell/reference/invoke-akamairestmethod
Updated 1 day ago