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

REST post replace object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Major
    • None
    • 12.10.10, 13.10.2
    • REST
    • Unknown
    • N/A
    • N/A

    Description

      For a REST POST request for the URL "rest/wikis/

      {wikiName}

      /spaces/XWiki/pages/XWikiPreferences/objects" the answer is always with the same object ID.

      Example of the property "href" in the answer :
      {{"href":"

      {xwikiWebSite}

      /rest/wikis/{wikiName}

      /spaces/XWiki/pages/XWikiPreferences/objects/XWiki.XWikiGlobalRights/2"}}

      Test with CURL (Supposed you have a wiki named "projetbidon" :

      WIKI="projetbidon"
       echo "Get instances of XWiki.XWikiGlobalRights for wiki "$WIKI
       curl -u $USER_REST \
       -X GET \
       -H "Content-type: application/x-www-form-urlencoded" \
       -H "Accept: application/json" \
       $URI_REST/wikis/$WIKI/spaces/XWiki/pages/XWikiPreferences/objects/XWiki.XWikiGlobalRight?media=json;
      
      echo "Add an instance of XWiki.XWikiGlobalRights for wiki "$WIKI
       curl -u $USER_REST \
       -X POST \
       -H "Content-type: application/x-www-form-urlencoded" \
       -H "Accept: application/json" \
       -d "className=XWiki.XWikiGlobalRights" \
       -d "property#allow=1" \
       -d "property#groups=groupe_bidon_1" \
       -d "property#levels=login,view,edit,delete,creator,register,comment,script,admin,createwiki,programming" \
       $URI_REST/wikis/$WIKI/spaces/XWiki/pages/XWikiPreferences/objects?media=json;
      
      echo "Add a another instance of XWiki.XWikiGlobalRights for wiki "$WIKI
       curl -u $USER_REST \
       -X POST \
       -H "Content-type: application/x-www-form-urlencoded" \
       -H "Accept: application/json" \
       -d "className=XWiki.XWikiGlobalRights" \
       -d "property#allow=1" \
       -d "property#groups=groupe_bidon_2" \
       -d "property#levels=login,view,edit" \
       $URI_REST/wikis/$WIKI/spaces/XWiki/pages/XWikiPreferences/objects?media=json;
      
      echo "Get list of objects XWiki.XWikiGlobalRight"
      
      curl -u $USER_REST \
       -X GET \
       -H "Content-type: application/x-www-form-urlencoded" \
       -H "Accept: application/json" \
       $URI_REST/wikis/$WIKI/spaces/XWiki/pages/XWikiPreferences/objects/XWiki.XWikiGlobalRights?media=json;
       # Problem here the object with "property#groups=groupe_bidon_1" is not listed
      

      Attachments

        Activity

          People

            surli Simon Urli
            Camille_D Camille Desmots
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: