1 Reply Latest reply on Sep 17, 2013 11:48 AM by thirumala

    REST API : Unable to update a document by adding a new attachment

    thirumala

      Using REST V3 API 'CONTENTS' endpoint we are trying to update a note by adding one more attachment. This document already has one attachment when it was created .

      POST call on '/attachments/contents/{document id}' with a new attachment would wipe out existing one from the note.

       

      Here is an example of JSON for this scenario.

       

      1. Create a new document with an attachment:

      https://jiveex.com/api/core/v3/contents

      POST verb

      JSON :

       

      {

          "content": {

              "type": "text/html",

              "text": "<TEXTFORMAT LEADING=\"2\"><P ALIGN=\"LEFT\"><FONT FACE=\"Arial\" SIZE=\"12\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\">TK Upload test</FONT></P></TEXTFORMAT>"

          },

          "subject": "TK Upload test",

          "type": "document",

          "parent": "https://jiveex.com/api/core/v3/places/6226",

          "categories": [

              "Interactions",

              "Issues / Support"

          ],

          "tags": [],

          "attachments": [

              {

                  "name": "1.jpg",

                "url": "https://jiveex.com/people/sam/avatar/24.png" ,           "type": "null",

                  "doUpload": true,

                  "contentType": "multipart/form-data",

                  "size": 322636

              }

          ]

      }

       

      2. Get the attachments reference URI from the note and post a new attachment :

       

      https://jiveex.com/api/core/v3/attachments/contents/9810

      POST verb :

      JSON :

       

       

      {

          "attachments": [

              {

                 "name": "2.jpg",

                "url": "https://jiveex.com/people/joe/avatar/46.png" ,

                "type" : "attachment",

                    "doUpload": true,

                  "contentType": "multipart/form-data",

                  "size": 322636

              }

          ]

      }

       

       

      Is anything missing from the second POST request for posting a new attachment on an existing document?