3 Replies Latest reply on Nov 2, 2018 1:03 PM by Tyler Lantz

    JSON -- Add Workbook Permissions

    Tyler Lantz

      Hello,


      I'm trying to add a group permission for a given workbook using JSON.  I've had success with XML (using postman), but I receive the following error when I make the same request with JSON.

       

      {

          "error": {

              "summary": "Bad Request",

              "detail": "Payload is either malformed XML/JSON or incomplete",

              "code": "400000"

          }

      }

       

      Here is the XML request followed by the JSON request.  The syntax for the JSON request looks correct to me based on documentation here: REST API Example Requests. I believe the headers are set correctly, as I've had success with the 'Update a Resource' example.

       

      XML:

      PUT SERVER/api/3.0/sites/site_id/workbooks/workbook_id/permissions

      x-tableau-auth: auth_token

       

      <tsRequest>

         <permissions>

            <workbook id="workbook_id" />

            <granteeCapabilities>

               <group id="group_id" />

               <capabilities>

                  <capability name="Read" mode="Allow" />

               </capabilities>

            </granteeCapabilities>

         </permissions>

      </tsRequest>

       

       

      JSON:

      PUT SERVER/api/3.0/sites/site_id/workbooks/workbook_id/permissions

      x-tableau-auth: auth_token

      Content-Type: application/json

       

      {

         "permissions":{

            "workbook":{

               "id":"workbook_id"

            },

            "granteeCapabilities":{

               "group":{

                  "id":"group_id"

               },

               "capabilities":{

                  "capability":{

                     "name":"Read",

                     "mode":"Allow"

                  }

               }

            }

         }

      }

       

      Regards,

      Tyler