-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaces.gs
More file actions
53 lines (38 loc) · 1.75 KB
/
places.gs
File metadata and controls
53 lines (38 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//#####################################
// Title: Places API (standard Jive REST API v3)
// Description : All API functions around the places
// Author: Thomas Lambert
// Date : 01/26/2015
// Version : 1.0
//#####################################
function getPlaces(){
// Get places : this function is useful to get the ID of a PLACE
// Ajust filters, launch search and view results in the log
// https://developers.jivesoftware.com/api/v3/cloud/rest/PlaceService.html#getPlaces(List<String>, String, int, int, String)
// Filters
// ?filter=search(test,report)
// recentlyviewed
// ?filter=type() = space, blog, group ...
var result = fetch( BASEURL + "/places/?filter=type(group)&filter=search(test collaboration)&count=100" , options("get")).list;
for(var i in result){
Logger.log(i + " " + result[i].name + " " + result[i].placeID);
}
}
function getPlaceDisplayName(placeId , logJson){
return fetch( BASEURL + "/places/" + placeId , options("get") , logJson).displayName;
}
function getFollowersFromPlace( placeId , logJson ){
return fetch( BASEURL + "/places/" + placeId + "/followers?count=1000" , options("get")).list;
}
function moveAllContent(){
// plus d'info ici sur l'API "move" : https://community.jivesoftware.com/thread/263422
var sourcePlaceId = 89172;
var targetPlaceId = 89176;
var allContent = fetch( BASEURL + "/contents?filter=place(" + BASEURL + "/places/" + sourcePlaceId + ")&count=100" , options("get")).list;
var targetPlace = fetch( BASEURL + "/places/" + targetPlaceId , options("get"));
for( var i in allContent){
allContent[i].parent = targetPlace.resources.self.ref
Logger.log( allContent[i] )
var result = fetch( allContent[i].resources.self.ref , options("put" , allContent[i]));
}
}