cancel
Showing results for 
Search instead for 
Did you mean: 

Filter site list by sitePreset

ottopodo
Champ in-the-making
Champ in-the-making
Hello,
I'm trying to obtain a list of sites with a custom sitePreset I created.
I modified site-finder.js adding an arg that should be passed to sites.get.js repository script (spf).

http://MYSERVER/share/proxy/alfresco/api/sites?size=250&spf=company-site-dashboard&nf=

I always obtain the complete list of sites regardless of sitePreset.
Can you please help me?

Marco
2 REPLIES 2

ottopodo
Champ in-the-making
Champ in-the-making
I solved my problem by modifing sites.get.js re-adding a filter sitePreset on resulting sites.
But this is a simple workaround. Any idea about the problem?


function main()
{
    // Get the filter parameters
    var nameFilter = args["nf"];
    var sitePreset = args["spf"];
    var sizeString = args["size"];
    var mysites = [];
   
    // Get the list of sites
    var sites = siteService.listSites(nameFilter, sitePreset, sizeString != null ? parseInt(sizeString) : 0);
   
    if(sitePreset && sitePreset != ''){
   for(i=0; i<sites.length; i++) {
      if(sites[i].sitePreset == sitePreset){
         mysites.push(sites[i]);
      }
   }
    model.sites = mysites;
    }
    else{
    model.sites = sites;
    }
  
}

main();

zbennett
Champ in-the-making
Champ in-the-making
I've been having the same problem through both the JavaScript Services API and the REST API.  I've found that it's possible to filter by name, but not by site preset type.

I get the same end result using (and then parsing) each of these:

JavaScript API
siteService.listSites("", "project-site-dashboard");

REST API
var connector = remote.connect("alfresco");
var result = connector.get("/api/sites?spf=project-site-dashboard");

PS - I may be paraphrasing the code that I tested, as I'm rewriting it from memory. I tried sending several combinations of parameters for each API, hoping that something was poorly documented and I could magically get it to work.