Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22337

Updating just the hidden property is impossible via the REST API

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 7.3
    • REST
    • None
    • Unknown

    Description

      Steps to reproduce:

      1. Create a (non-hidden) page
      2. Execute the following JavaScript snippet in the browser's console:
        fetch(require('xwiki-meta').restURL, {
          method: 'PUT',
          headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json'
          },
          body: JSON.stringify({
            hidden: true
          })
        })
        .then(response => response.json())
        .then(json => {
          console.log('Response:', json);
        })
        .catch(error => {
          console.error('Error sending PUT request:', error);
        });
        

      Expected result:

      The page is now hidden and the updated page is logged.

      Actual result:

      The page hasn't been updated and an error "Error sending PUT request: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" is logged because the response is empty (status 304 not modified). This is very related to XWIKI-22336 as while the code always applies the hidden property, it never marks the document as modified after changing it.

      As a workaround, any property like the title can be specified with the same value as returned by the REST API, then the document is correctly updated.

      Attachments

        Activity

          People

            MichaelHamann Michael Hamann
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: