Edit

Share via


Invoke-PowerBIRestMethod

Executes a REST call to the Power BI service, with the specified URL and body.

Syntax

Default (Default)

Invoke-PowerBIRestMethod
    -Url <String>
    -Method <PowerBIWebRequestMethod>
    [-Body <String>]
    [-OutFile <String>]
    [-ContentType <String>]
    [-Headers <Hashtable>]
    [-TimeoutSec <Int32>]
    [-Organization <String>]
    [-Version <String>]
    [<CommonParameters>]

Description

Invokes a REST request against the Power BI service using the profile you're logged in with. The REST verb can be specified using the -Method parameter. The -Body parameter is required for the verbs POST, PUT, and PATCH. Before you run this command, make sure you log in using Connect-PowerBIServiceAccount.

Examples

Example 1

PS C:\> Invoke-PowerBIRestMethod -Url 'groups' -Method Get

Invokes the URL https://api.powerbi.com/v1.0/myorg/groups with the GET method\verb.

Parameters

-Body

Body of the request, also known as content. This is optional unless the request method is POST, PUT, or PATCH.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ContentType

Content type to specify inside the header for the request. Default is 'application/json'.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Headers

Optional headers to include with the request.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Method

Type of HTTP request method\verb to make with the call.

Parameter properties

Type:PowerBIWebRequestMethod
Default value:None
Accepted values:Get, Post, Delete, Put, Patch, Options
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Organization

Organization name or tenant GUID to include in the URL. Default is 'myorg'.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OutFile

Output file for writing the response content to. File path specified must not exist.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeoutSec

Specifies how long the request can be pending before it times out. Enter a value in seconds. Entering a value of 0 specifies an indefinite time-out.

Parameter properties

Type:Int32
Default value:100
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Url

Relative or absolute URL of the Power BI entity you want to access. For example, if you want to access https://api.powerbi.com/v1.0/myorg/groups, then specify 'groups', or pass in the entire URL.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Version

Version of the API to include in the URL. Default is 'v1.0'. Ignored if -Url is an absolute URL.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

System.Object