Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 2.74 KB

Invoke-CIPPRestMethod.md

File metadata and controls

44 lines (36 loc) · 2.74 KB

Invoke-CIPPRestMethod

SYNOPSIS

Invokes a REST method using the CIPP API.

DESCRIPTION

The Invoke-CIPPRestMethod function is used to send HTTP requests to the CIPP API. It supports various HTTP methods such as GET, POST, PUT, DELETE, etc. The function assembles the request parameters, including the endpoint, query parameters, request body, headers, and authorization token. It then sends the request using the Invoke-RestMethod cmdlet and returns the response.

PARAMETERS

-Endpoint

Foo Foo
The endpoint of the API to send the request to.

-Params

Foo Foo Foo
Optional. A hashtable of query parameters to include in the request URL.

-Method

Foo Foo Foo
Optional. The HTTP method to use for the request. The default value is 'GET'.

-Body

Foo Foo Foo
Optional. A hashtable representing the request body. It will be converted to JSON before sending the request.

-ContentType

Foo Foo Foo
Optional. The content type of the request body. The default value is 'application/json'.

-Authorization

Foo Foo
Optional. The authorization token to include in the request headers.

EXAMPLE 1

PS > Invoke-CIPPRestMethod -Endpoint '/api/Listusers' -Method 'GET' -Params @{ 'tenantfilter' = '11c11ab1-527a-1d29-l92e-76413h012s76' }

EXAMPLE 2

PS > Invoke-CIPPRestMethod -Endpoint '/api/ListMailboxPermissions' -Params @{ 'tenantfilter' = 'M365x72601982.onmicrosoft.com', 'userid' = '11c11ab1-527a-1d29-l92e-76413h012s76'}

EXAMPLE 3

PS > Invoke-CIPPRestMethod -Endpoint '/api/adduser' -method 'POST' -Body @{ 'tenantID' = '11c11ab1-527a-1d29-l92e-76413h012s76';'DisplayName' = 'Test User';'UserName' = 'testuser';'AutoPassword' = $true;'FirstName' = 'Test';'LastName' = 'User';'Domain' = 'M365x72601982.onmicrosoft.com';'CopyFrom' = "" }