Here a trick to list your Tempo Teams of your Jira Server in a Confluence Server page using the public Tempo API.

It’s very easy to do, but only possible in Server version of Confluence.

Just insert in the page a HTML Macro and fill with this Javascript/jQuery/Ajax/HTML code, That’s all!

Captura de pantalla 2018-04-20 a las 19.37.33

Here the code:

<div id="teamsIDX">
<h1>Team List</h1>
</div>
<script>
(function() {

function getTempoTeams()
{
var user;
	// Documentation: https://tempoplugin.jira.com/wiki/spaces/JTMT/pages/78381258/Teams+REST+API+Guide#TeamsRESTAPIGuide-getAllTeams
     AJS.$.ajax({
        url: "/rest/tempo-teams/1/team",
        type: 'get',
        dataType: 'json',
        async: false,
        success: function(data) {
            groups = data;
        }
     });
     return groups;
}
 
function getTempoMembers( team_id)
{
var user;
	// Documentation: https://tempoplugin.jira.com/wiki/spaces/JTMT/pages/78381258/Teams+REST+API+Guide#TeamsRESTAPIGuide-getTeamMembersUsers
     AJS.$.ajax({
        url: "/rest/tempo-teams/2/team/"+ team_id +"/member",
        type: 'get',
        dataType: 'json',
        async: false,
        success: function(data) {
            members= data;
        }
     });
     return members;
}
 
var groups = getTempoTeams();
i = 0;
//while ( i < groups.length) {
while ( i < 3) {
	$('#teamsIDX').html($('#teamsIDX').html() + "
<b>" + groups[i].name + "</b>");
	var members = getTempoMembers(groups[i].id);
	j = 0;
	while ( j < members.length) {
		$('#teamsIDX').html($('#teamsIDX').html() + "
" + members[j].member.name + "");
		j++;
	}
	i++;
}
 
})();
</script>
Advertisements
Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s