Skip to content

[BUG] Invoke-PnPSPRestMethod - Pages API - Publish - The input does not contain any JSON tokens #2776

@SjoerdV

Description

@SjoerdV

Reporting an Issue

Using the Pages api through SharePoint REST API v2, this command:

Invoke-PnPSPRestMethod -Url "https://<tenant>.sharepoint.com/_api/v2.0/sites('<tenant>.sharepoint.com,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000')/pages/00000000-0000-0000-0000-000000000000/oneDrive.publish" -Method "POST" -ContentType "application/json" -Content @{} -ErrorAction Stop

(all guids replaced with empty guid)

returns:

The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

Expected behavior

Publish the Modern Page

Actual behavior

Error message as depicted above.

NOTE1: it does not matter if the 'Content' parameter is omitted
NOTE2: it does not matter if the Url suffix 'oneDrive.publish' is replaced with 'publish'
NOTE2: the exact same call passes without error through a direct Graph call using EasyGraph Module and Invoke-PnPGraphMethod:

Invoke-PnPGraphMethod -Method POST -Url "beta/sites/<tenant>.sharepoint.com,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000/pages/00000000-0000-0000-0000-000000000000/publish" -ContentType "application/json" -ErrorAction Stop

What is the version of the Cmdlet module you are running?

1.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions