5 Replies Latest reply on Oct 11, 2012 11:07 AM by mtuljapurkar

    Cannot upload an attachment to a Jive Document - via REST API.

      Hello Jivers,

       

      I am trying to create a Jive document with an attachment. It works when I specify the url with the file extension. Eg: Here is the portion of the input Json with the attachment field  as shown

      ...

      "attachments" : [ {

             "name" : "REST_Sample Doc1",

             "type" : "attachment",

             "url" : "http://www.swiftview.com/tech/letterlegal5.doc",

             "contentType" : "application/msword",

             "doUpload" : true

      } ]

      ...

       

      This works fine. Now I want to copy an existing Jive file, a ms word file that is located at the following url :  http://apps-public-cloud-trunk.jivesoftware.com/api/core/v3/attachments/1291/data  (this Url was returned in the Json when I do a REST call for the existing Jive file as shown below).

       

      {

             "name" : "REST_Sample Doc",

             "type" : "attachment",

             "size" : 29696,

             "contentType" : "application/msword",

             "url" : "https://apps-public-cloud-trunk.jivesoftware.com/api/core/v3/attachments/1291/data",

             "doUpload" : false,

             "id" : "1291",

             "resources" : {

                  "self" : {

                       "ref" : "https://apps-public-cloud-trunk.jivesoftware.com/api/core/v3/attachments/1291",        

                       "allowed" : [ "GET", "DELETE" ]   

                  }

             }

      }

       

       

      When I use this content type & url in my Json post for attaching this to my new Jive doc via the REST api,  I get a 500 internal server error. Attached is portion of the Json input for creating the new attachment for the new Jive doc.

      ...

      "attachments" : [ {

             "name" : "REST_Sample Doc1",

             "type" : "attachment",

             "url" : "https://apps-public-cloud-trunk.jivesoftware.com/api/core/v3/attachments/1291/data",

             "contentType" : "application/msword",

             "doUpload" : true

      } ]

      ...

       

      I am guessing that for this file url, the returned content type might be some binary mime type which might be causing the error. What is the correct content type for this attachment ? I might be missing something basic here. Appreciate any useful leads. Thanks.

       

      ~Sunil

      de