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


Invoke-AkamaiRestMethod -Method "GET" -Path "/path/to/api"

GET without query parameters.


Invoke-AkamaiRestMethod -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-AkamaiRestMethod -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-AkamaiRestMethod -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-AkamaiRestMethod -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-AkamaiRestMethod -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

‑Method

The request method.

‑Path
Required

Your request path.

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

‑IncludeResponseHeaders

When the switch parameter is present, this includes the response header data in the output.

‑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