0 Replies Latest reply on Feb 17, 2016 10:06 AM by laurent.ducamp@ext.adeo.com

    problem with rest API content endpoint and base64 image

    laurent.ducamp@ext.adeo.com

      Hi,

       

      We are "on promise"  V8 and we have a application that post document in Jive. It works fine in V7 but it failed in V8.

       

      We use the Jive REST API , and the endpoint /contents,

       

       

       

      But, we encode in body text the image in Base64 ...

       

      We do something like :

       

      curl -i -u 20006144 -H "Content-Type: application/json" --data '{ "parent": "https://younity.groupeadeo.com/api/core/v3/places/518999", "type": "discussion", "content": { "type": "text/html", "text":"<body><img src=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUSE .... huge string .... HhgxbSB8ZMv2WKxF4UiGUuQTodnJtqWToKFChasapNIz7g9iJ1NsxjLIW18yMD5b/iK5h8zSEGNktlEj2F8ozNYewvYUKFcuwHtHJJmbc3P1P8AWkch9aFCiSFt0f/Z\"/></body>"}, "subject": "A new discussion"}' https://younity.groupeadeo.com/api/core/v3/contents

       

      When image are smaller than 15KB , it work fine .

       

      We have an HTTP code 201, and the response. The content field is filled with a huge string  (ie : the following JSON) :

        },

      "content" : {

        
      "text" : "<body><!--
      [DocumentBodyStart:5b2bdbed-cf79-424c-aa4a-97a7e7995307] --><div
      class=\"jive-rendered-content\"><a
      href=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/

      ....

      ....

      wDQc0X/AMDYv/iqKx6KXsYhc//Z\"/></a></div><!--
      [DocumentBodyEnd:5b2bdbed-cf79-424c-aa4a-97a7e7995307]
      --></body>",

          "editable" : false,

          "type" : "text/html"

        },

       

       

      But when Image is greater (350 KB)  ... We have a HTTP  201, but the content field is empty !!!

       

        "content" : {

        
      "text" : "<body><!--
      [DocumentBodyStart:8cc3e6f8-8481-4e39-b1c9-995c7586c85b] --><div
      class=\"jive-rendered-content\"></div><!--
      [DocumentBodyEnd:8cc3e6f8-8481-4e39-b1c9-995c7586c85b]
      --></body>",

          "editable" : false,

          "type" : "text/html"

        },

       

      {

      "resources" : {

          "entitlements" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/entitlements"

          },

          "outcomeTypes" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/outcomeTypes"

          },

          "childOutcomeTypes" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/childOutcomeTypes"

          },

          "followingIn" : {

            "allowed" : [ "POST", "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/followingIn"

          },

          "editHTML" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/docs/DOC-138247/edit"

          },

          "attachments" : {

            "allowed" : [ "POST", "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/attachments/contents/785255"

          },

          "comments" : {

            "allowed" : [ "POST", "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/comments"

          },

          "read" : {

            "allowed" : [ "DELETE", "POST" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/read"

          },

          "followers" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/followers"

          },

          "versions" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/versions/785255"

          },

          "outcomes" : {

            "allowed" : [ "POST", "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/outcomes"

          },

          "self" : {

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

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255"

          },

          "html" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/docs/DOC-138247"

          },

          "extprops" : {

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

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/extprops"

          },

          "likes" : {

            "allowed" : [ "GET" ],

            "ref" : "https://younity.groupeadeo.com/api/core/v3/contents/785255/likes"

          }

        },

        "followerCount" : 0,

        "likeCount" : 0,

        "published" : "2016-02-17T17:57:13.607+0000",

        "tags" : [ ],

        "updated" : "2016-02-17T17:57:14.204+0000",

        "iconCss" : "jive-icon-document",

        "parentPlace" : {

          "id" : "3860",

          "html" : "https://younity.groupeadeo.com/community/demo-younity",

          "name" : "Demo Younity",

          "type" : "space",

          "uri" : "https://younity.groupeadeo.com/api/core/v3/places/518999"

        },

        "contentID" : "785255",

        "author" : {

          "id" : "85804",

          "resources" : {

            "reports" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@reports"

            },

            "followingIn" : {

              "allowed" : [ "POST", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/followingIn"

            },

            "images" : {

              "allowed" : [ "POST", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/images"

            },

            "activity" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/activities"

            },

            "manager" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@manager"

            },

            "social" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@social"

            },

            "streams" : {

              "allowed" : [ "POST", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/streams"

            },

            "recognition" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@recognition"

            },

            "trendingContent" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@trendingContent"

            },

            "trendingPlaces" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@trendingPlaces"

            },

            "avatar" : {

              "allowed" : [ "PUT", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/avatar?a=19145"

            },

            "blog" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/places/764608"

            },

            "followers" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@followers"

            },

            "pages" : {

              "allowed" : [ "POST", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/pages"

            },

            "colleagues" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@colleagues"

            },

            "following" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/@following"

            },

            "members" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/members/people/85804"

            },

            "self" : {

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

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804"

            },

            "html" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/people/20006144"

            },

            "securityGroups" : {

              "allowed" : [ "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/securityGroups"

            },

            "extprops" : {

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

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/extprops"

            },

            "tasks" : {

              "allowed" : [ "POST", "GET" ],

              "ref" : "https://younity.groupeadeo.com/api/core/v3/people/85804/tasks"

            }

          },

          "displayName" : "LAURENT DUCAMP",

          "emails" : [ {

            "jive_label" : "Email",

            "primary" : true,

            "type" : "work",

            "value" : "laurent.ducamp@ext.adeo.com",

            "jive_displayOrder" : 8,

            "jive_summaryDisplayOrder" : 4,

            "jive_showSummaryLabel" : false

          } ],

          "jive" : {

            "externalContributor" : false,

            "username" : "20006144"

          },

          "name" : {

            "familyName" : "DUCAMP",

            "formatted" : "LAURENT DUCAMP",

            "givenName" : "LAURENT"

          },

          "type" : "person"

        },

        "content" : {

          "text" : "<body><!-- [DocumentBodyStart:8cc3e6f8-8481-4e39-b1c9-995c7586c85b] --><div class=\"jive-rendered-content\"></div><!-- [DocumentBodyEnd:8cc3e6f8-8481-4e39-b1c9-995c7586c85b] --></body>",

          "editable" : false,

          "type" : "text/html"

        },

        "parent" : "https://younity.groupeadeo.com/api/core/v3/places/518999",

        "favoriteCount" : 0,

        "replyCount" : 0,

        "status" : "published",

        "subject" : "test de document en java Wed Feb 17 18:57:21 CET 2016",

        "viewCount" : 1,

        "visibleToExternalContributors" : false,

        "parentVisible" : true,

        "parentContentVisible" : true,

        "lastActivity" : 1455731834204,

        "authorship" : "open",

        "categories" : [ ],

        "visibility" : "place",

        "outcomeTypes" : [ {

          "id" : "8",

          "name" : "official",

          "shareable" : false,

          "noteRequired" : false,

          "urlAllowed" : false,

          "generalNote" : false,

          "confirmExclusion" : true,

          "confirmUnmark" : false

        }, {

          "id" : "3",

          "name" : "pending",

          "shareable" : true,

          "noteRequired" : true,

          "urlAllowed" : false,

          "generalNote" : false,

          "confirmExclusion" : false,

          "confirmUnmark" : false

        }, {

          "id" : "6",

          "name" : "success",

          "communityAudience" : "true",

          "shareable" : false,

          "noteRequired" : true,

          "urlAllowed" : false,

          "generalNote" : true,

          "confirmExclusion" : false,

          "confirmUnmark" : false

        }, {

          "id" : "2",

          "name" : "finalized",

          "shareable" : false,

          "noteRequired" : false,

          "urlAllowed" : false,

          "generalNote" : false,

          "confirmExclusion" : true,

          "confirmUnmark" : true

        }, {

          "id" : "9",

          "name" : "wip",

          "confirmContentEdit" : "true",

          "shareable" : false,

          "noteRequired" : false,

          "urlAllowed" : false,

          "generalNote" : false,

          "confirmExclusion" : true,

          "confirmUnmark" : true

        }, {

          "id" : "7",

          "name" : "outdated",

          "shareable" : false,

          "noteRequired" : false,

          "urlAllowed" : true,

          "generalNote" : false,

          "confirmExclusion" : false,

          "confirmUnmark" : false

        } ],

        "attachments" : [ ],

        "restrictComments" : false,

        "type" : "document"

      }

       

       

      Is there some limitation on JSON body ? Why we haven't a HTTP 409 code (like describe in documentation )

       

       

       

      PS : In attachment, the Full JSON response.