powershell
powershell copied to clipboard
[FEATURE] Add ability to use batch API with Invoke-PnPSPRestMethod
Category
- [x] Feature request
Describe the feature
Add ability to use batch API with Invoke-PnPSPRestMethod
Describe the solution you'd like
$batch = New-PnPBatch
Invoke-PnPSPRestMethod -Method Get -Url "/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/sites('e8ef6ff7-220f-49d4-bd21-739bc66540c2')" -Batch
Invoke-PnPSPRestMethod -Method Get -Url "/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/sites('3975956e-2a3a-43eb-8312-3833fb523874')" -Batch
Invoke-PnPSPRestMethod -Method Get -Url "/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/sites('3ecc13a9-a83f-4403-8870-f5417e95b60c')" -Batch
Invoke-PnPSPRestMethod -Method Get -Url "/_api/Microsoft.Online.SharePoint.TenantAdministration.Tenant/sites('5459a6c1-f748-4737-bc52-6b66bbf53cf2')" -Batch
Invoke-PnPBatch -Batch $batch
Good feature request @joerodgers. Given this means updating PnP PowerShell I'll move this issue to the PnP PS repo.
Invoke-PnPSPRestMethod
automatically adds the header "accept", "application/json;odata=nometadata"
which causes any /_api/$batch
responses to not include any response details. This header value will need remove the odata=nometadata
option to allow Invoke-PnPSPRestMethod
to be used to call the $batch endpoint.
https://github.com/pnp/powershell/blob/cda794b5292576d4049158223c401d163f428b3d/src/Commands/Base/InvokeSPRestMethod.cs#L55
Has there been any update on this?