2 Replies Latest reply on Jul 15, 2016 3:43 AM by gopi.gorantala

    JS API to get users mapped to a department

    gopi.gorantala

      Ryan Rutan Pawan ShahScott A JohnsonNils Heuer

       

      Is there any way in JS API to get users according to their departments ?

       

      Thanks,

      -Gopi.

        • Re: JS API to get users mapped to a department
          gopi.gorantala

          Ryan Rutan  -Can you let me know if I can get users based on the department using API ?

           

          My requirement is to pull all users based on the department and display them based on the department they are into.

           

          I am trying achieve this by add-on. I tried below code, it displays following in Jive 8.0.3.  Can you tell me is this requirement achievable through API or not ? FYI - Quirks, bugs and improvement requests for the JS and REST APIs

           

          output:

          throw 'allowIllegalResourceCall is false.';

          [ "company", "department" ]

           

          code:

          $j.ajax({

             url: '/api/core/v3/people/@filterableFields',
             dataType: 'text',
             type: 'GET',
             success: function (filteredprofilefields) {

             console.log('filtered profile fields are'+filteredprofilefields);

            }

          })

           

          cc: Jiban Patro, sunny k

            • Re: JS API to get users mapped to a department
              gopi.gorantala

              I found a way to get the results through REST call, but I can't get the results through OSAPI ?

               

              REST approach -  '/api/core/v3/people?filter=department(departmentName)'

               

              JS approach -

              osapi.jive.corev3.people.getFilterableFields({id:2014}).execute(function(person) {

                 console.log('person object is :'+JSON.stringify(person));  //output:-     person object is :{"content":["company","department"],"status":200}

              1 person found this helpful