6 Replies Latest reply on Oct 25, 2012 8:21 PM by craig.mcclanahan

    Bookmark API

      Hi DevTeam and Ryan King / Mark Weitzel / Brian Shoemaker  , it was great meeting all of you at Jiveworld! i am hoping you'll be able to help us out with our little issue.

       

      What we would like to do :

      • create our own button to bookmark an internal URL with parameters and then share it (we would like to eventually bundle these actions into a single click)

       

      What happens when we bookmark a URL with parameters :

      • METHOD 1 : Using bookmarklet
        • the bookmarklet only seems to be able to save the core URL only. If there are parameters in the URL, we get an error message (details below)
      • METHOD 2 : Using "Create --> Bookmark"
        • So far, METHOD 2 answers all of our requirements, except we are unable to find the API which controls this functionality. Please help!

       

      What are we asking you to help us with :

      • Can you help us find the API behind METHOD 2 , so we can repackage it into a single click and use it within one of our new plugins

       

       

      Below are the two examples of how we used METHOD 1 AND METHOD 2 (for reference):

      __________________________________________________________________________________________________________

       

      There are two ways of bookmarking within the community. Here are the two examples :

       

      1. METHOD 1 : Install bookmarklet from : https://community.jivesoftware.com/bookmarks

       

             2. METHOD 2 : Add bookmark by clicking "CREATE" --> "BOOKMARK"

        • bookmark create.png
          • Pase URL w/ parameters into web address
          • create a bookmark.png
          • Add Notes and Tags
          • add bookmark2.png
          • Open bookmark : and share bookmark
          • openbookmark.png
          • So far, METHOD 2 answers all of our requirements, except we are unable to find the API which controls this functionality.
          • This is the functionality we would like to streamline in a single click (and preserving the URL parameters)
            • other questions :
              • with this API, can we also inject NOTES and TAGS directly into the bookmark?

       

       

      We appreciate all the help.

      Thanks,

      Caster

        • Re: Bookmark API

          Perhaps this is a tangent but... Would you consider using Jive Anywhere instead of bookmarks?

          • Re: Bookmark API

            Here is the V3 API for sharing:

            Jive REST API v3.0 → Share entity

             

            This is available on Jive 6. This is not available on earlier versions of Jive.

            1 person found this helpful
              • Re: Bookmark API

                thanks for the reply Mark. Indeed JiveAnywhere carries similar functionalities, but this one in particular is to be embedded within a custom plugin of ours (screenshot below). (heads up, we're on 5.0.1)

                 

                Would you know of any other way i would be able to share the URL within the community? When I copy and paste the URL in a direct message, it truncates the URL and removes the parameters, so the path is incorrect on the receiving side of the direct message. So we thought of using the bookmarks to save and share the URL.

                 

                note: The reason we need to save the search criteria is so that when the user returns to the space, it will remember their "favorite" searches within the space

                (by tagging the space ID within the bookmark , we can display the bookmarked URLs relevant to the space the user is in.)

                 

                knowledge plugin ss.png

              • Re: Bookmark API
                thomas.schiffmann

                Hi Caster,

                we had the same problem today (we have another site that implements the bookmarklet code in some "Add bookmark in Jive" links) and after we found your post I tried to debug the whole bookmarking use case and I think I found a workaround that can be implemented in a theme.

                As the error message says, there is a problem with the token that is generated and submitted/posted by the form. The token for the bookmarklet form is created in the freemarker template "favorites/include/create-favorite-form.ftl" (line 11 in 5.0.3):

                <@jive.token name="create.bookmark.${url!?html}" />
                

                 

                I copied the template "favorites/include/create-favorite-form.ftl" to our theme and replaced the line with this code:

                <#if (url!?length > 200) >
                        <@jive.token name="create.bookmark.${url!?substring(0, 200)}" />
                    <#else>
                        <@jive.token name="create.bookmark.${url!}" />
                    </#if>
                

                 

                I did some reference tests by adding a bookmark for a google search, which has a quite long query string. With a very long token name, the token cannot be saved to the database because of a maximum length constraint in the table column. After I shortened the token name in the template, I was still getting the error message - probably because of the query string parameters. I am not sure about this but I think that the generated html entities (${url!?html}) are replaced somewhere and the token validation does not work anymore. So I removed the html encode function. I don't know if removing this function is the best idea - probably it would be even better to remove all special characters. Perhaps someone has some good ideas on this?

                 

                The second bookmarking use case you described is not affected by this implementation because the url property is not used at all in this use case (it is null, but I didn't track down where the url is transferred in this use case). So the final generated token name is always "create.bookmark." in the second use case.

                 

                Best regards,

                Thomas