11 Replies Latest reply on Feb 16, 2016 3:31 PM by bprakash1359

    Finding place ID using search filter

    bprakash1359

      Hi Team,

       

      We have requirement where we need to find placeID of a Jive group for which we are using the following API call:

      https://<jive-proxy>/places?filter=type(group)&fields=-resources,placeID,displayName&filter=search(<group-name>)

       

      We tested the above API call on two of our open jive groups. It returned a response for one group with the group details along with placeID. However, it did not return any group details in response for the other group.

       

      Basically, the same API worked for one group but not the other. Wondering if this could be an issue with API call that we are making or could be an issue with the groups created on Jive instance.

       

      Looking forward for your help ASAP. Please let me know for any further details required.

       

       

      Thanks

      Bhanu Prakash.

        • Re: Finding place ID using search filter
          bprakash1359

          With more specific details

           

          We have a requirement where we need to find placeID of a Jive group using displayName for which we are using the following API call:

          https://<jive-proxy>/places?filter=type(group)&fields=-resources,placeID,displayName&filter=search(<group-name>)

           

          Screenshot of format of the response where we are getting list of group details by making the above call:

           

          We tested the above API call on two of our open jive groups. It returned response for one group with the group details along with placeID. However, it did not return any group details in response for the other group.

           

          Basically, the same API worked for one group but not the other. Wondering if this could be an issue with API call that we are making or could be an issue with the groups created on Jive instance. Is the above API call that we are using to find placeID of a group using displayName, a correct one?

           

          Looking forward for your help ASAP. Please let me know for any further details required.

           

           

          Thanks

          Bhanu Prakash.

            • Re: Finding place ID using search filter
              whoiskevin

              Call looks correct to me and from the response it seems to be correct.

              There are not enough details here to diagnose anything else.  The search text being used and the two group names and display names would be useful information for a search query.  Visibility could be important if the user doing the search happens to not have access to one of the groups.  So many variables at that point it is difficult to tell. But if both are open groups then rights would not appear to be an issue.

                • Re: Finding place ID using search filter
                  bprakash1359

                  Thanks for the quick response Kevin.

                   

                  I'm making the calls for each group individually (not for both the groups together).

                   

                  Example: Say, group1 and group2 are the display names of the 2 groups I'm talking about. And user has access to both the groups. When I made the following API calls:

                  1. https://<jive-proxy>/places?filter=type(group)&fields=-resources,placeID,displayName&filter=search(group1)

                  JSON response [response may also contain details of groups that we didn't request for]:

                  {

                  "itemsPerPage" : 100,

                  "list" : [ {

                             "id" : "1111",

                  "placeID" : "12345",

                              "displayName" : "group1",

                             "type" : "group",

                             "typeCode" : 700

                             }, {

                             "id" : "1122",

                             "placeID" : "12121",

                             "displayName" : "groupxyz",

                             "type" : "group",

                             "typeCode" : 700

                             }],

                    "startIndex" : 0

                  }

                  Observation: In this case, we got the requested group details in response.

                   

                  2. https://<jive-proxy>/places?filter=type(group)&fields=-resources,placeID,displayName&filter=search(group2)

                  JSON response [response may also contain details of groups that we didn't request for]:

                  {

                  "itemsPerPage" : 100,

                  "list" : [ {

                             "id" : "1111",

                  "placeID" : "12345",

                             "displayName" : "groupabc",

                             "type" : "group",

                             "typeCode" : 700

                             }, {

                             "id" : "1122",

                             "placeID" : "12121",

                             "displayName" : "groupdef",

                             "type" : "group",

                             "typeCode" : 700

                             }],

                  "startIndex" : 0

                  }

                  Observation: In this case, we did not get the requested group details.

                   

                  QUESTION

                  In Scenario 2, why "group2" details not returned in response? I used the same Jive API call in both the scenarios. Am I making any mistake while calling the API? If not, what could be the reason for this API call not returning the requested group details? Though user is able to access both the groups in Jive, is there a chance that Jive API would restrict in response?

                    • Re: Finding place ID using search filter
                      whoiskevin

                      Your not making a mistake.  The execution of the search is the issue.  Since it is just a generic search it has a tendency to not always return what you expect.  It should but I've been able to duplicate similar behavior myself.  Attempting to get a place id solely from search is a kludge but about the only method supplied currently :-/  You might have to look at another method based on your use case.  For instance if you know a piece of content or something else you can use to back into the place id.

                      An addon can often interact more directly based on current context but attempting to use the API outside of context means hard coding a place id since there is little else that can guarantee a result.  Even if successful a search today for the string "group 2" might give you the group but if I create a group with a description containing that text you are suddenly getting multiples and unless there is user interaction to select the appropriate group it is difficult to automate.

                      You could try getting groups (GET on the places service) and paging through the results yourself.  Still another kludge though but actually better in that the results of paging through are more under your control since the content is always returned and search may or may not return what you want as you have found.

                      1 person found this helpful
                        • Re: Finding place ID using search filter
                          bprakash1359

                          Thanks Kevin. This is very helpful information.

                           

                          Basically our Use Case is:

                          User enters 'html:ref' of a jive group/place (ex: https://<jive-host>/groups/group1) in UI. Based on the 'html:ref' our application should retrieve all the discussions from the group/place.

                           

                          To achieve this I'm using the following 2 API calls after trimming group1 string (passed in the search filter of first API call) from 'html:ref' value that user provided in UI:

                          1. https://<jive-proxy>/places?filter=type(group)&fields=-resources,placeID,displayName&filter=search(group1)

                          • To retrieve the placeID that is required in the next API call

                          2. https://<jive-proxy>/places/12345/contents?filter=type(discussion)

                          • To retrieve discussion contents for the group: group1 using placeID that is retrieved in above API call.

                           

                          Could you please suggest any alternate approach that finally retrieves discussion content of a group using 'html:ref' value?

                            • Re: Finding place ID using search filter
                              whoiskevin

                              I think you are left with the iteration over the list and it sounds like Pawan has an example.

                               

                              I think getting a place id from a URI was suggested as an addition to the api as some point but I am not aware of it having made production.

                                • Re: Finding place ID using search filter
                                  pawans

                                  Also, i agree unfortunately the solution of iterating will give performance issues.

                                  You can reduce network calls by always pulling 100 items in one call instead of default 25 ( 100 being max allowed by jive in paginated responses).

                                    • Re: Finding place ID using search filter
                                      bprakash1359

                                      Two qq regarding iterating through paging results of search filter:

                                      1. As long as the keyword provided in search filter (keyword: displayName of a group), jive api should return the respective group details in any of the page if the group is available, right? Or, is there a chance that search filter API would skip the group (when displayName is provided as keyword) while sending response in any case?

                                      2. Is displayName always the same as group name? Ex: if group url is, https://<jive-host>/groups/group1 => is displayName=group1? Is this the same behavior always or is there a chance that displayName can be different from group name?

                                    • Re: Finding place ID using search filter
                                      bprakash1359

                                      Hi Kevin/Pawan,

                                       

                                      With the issue that we faced using Jive search API to find placeID of a jive group, we are going with an alternate approach where users have to directly input placeID in the UI.

                                      Following are the manual steps verified to get placeID of a jive group:
                                      [Note: User should make sure that he is authorized to access the group]

                                      • Browse Jive group URL (Ex: https://<jive-host>/groups/group1)
                                      • Right click on page and select 'View page source'
                                      • Search for 'browseId’ or ‘containerBrowseId'
                                      • You will see the placeID value assigned to browseId/containerBrowseId.

                                       

                                      Could you please confirm if this approach is accurate to find placeID of a jive group?

                                       

                                      Thanks

                                      Bhanu Prakash.

                                • Re: Finding place ID using search filter
                                  pawans

                                  We had similar issue where jive's first response never gave the group we wanted.

                                  I wrote some code which is here in my repo --> jive-python-scripts/JiveScripts.py at master · shahpawan/jive-python-scripts · GitHub

                                  Basically getting the paginated url and keep searching till you find the group.