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
Required

Your request path.

‑Method

The request method.

‑QueryParameters

The query parameters in a hashtable.

‑AdditionalHeaders

An additional headers in a hashtable.

‑Body

The request body to include in the auth calculation.

‑InputFile

An input file to be read as part of the auth calculation.

‑OutputFile

The file to write response data to.

‑MaxBody

The maximum size of the body parameter. Defaults to 128KB.

‑SkipHttpErrorCheck

When the switch parameter is present, this ignores HTTP error statuses and continues to process responses. The error responses are written to the pipeline just as if they were successful.

> Note: This parameter is only applicable with PowerShell 7+.

‑Retry

The retry index. Used to determine whether a failed request should be retried.

‑EdgeRCFile

Your EdgeGrid resource file to authenticate your command. Defaults to ~/.edgerc.

‑Section

The section name in your EdgeGrid resource file to retrieve authentication credentials from. Defaults to default.

‑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.

Related Links