User Group Endpoint

Get

This method returns a User Group.

Get/api/groups/{groupid}

The URL must have the Group Id. It returns the ProjectGroup Entity.

Microsoft.NET example:

var group = serviceManager.Groups.GetProjectGroup(2);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/2";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "GET",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
      alert('Success!');
    }
});

Get All

This method returns all User Groups.

Get/api/groups

It returns a list of ProjectGroup Entities.

Microsoft.NET example:

List<Countersoft.Gemini.Commons.Entity.Security.ProjectGroup> groups = serviceManager.Groups.GetProjectGroups();

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "GET",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
      alert('Success!');
    }
});

Create

This method creates a new Group.

POST/api/groups

The request body must contain the ProjectGroup entity. The return value is the new ProjectGroup entity where the Group Id field is populated.

Microsoft.NET example:

Countersoft.Gemini.Commons.Entity.Security.ProjectGroup group = new Countersoft.Gemini.Commons.Entity.Security.ProjectGroup();

group.Name = "Administrator";
group.Description = "Department Administrator";
group.Active = true;

serviceManager.Groups.CreateProjectGroup(group);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey
var geminiData = {
    Name: "Administrator",
    description: "Department Administrator",
    active: "true"
};

$.ajax({
    url: geminiUrl,
    type: "POST",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
        alert('Success!');
    }
        });

Update

This method updates an existing group.

PUT/api/groups

The request body must contain the ProjectGroup entity including the Id. The return value is the updated ProjectGroup entity.

Microsoft.NET example:

Countersoft.Gemini.Commons.Entity.Security.ProjectGroup group = new Countersoft.Gemini.Commons.Entity.Security.ProjectGroup();

group.Id = 12;
group.Name = "Administrator";
group.Description = "General Administrator";
group.Active = true;

login.Groups.UpdateProjectGroup(group);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey
var geminiData = {
                  Id: "12",
                  Name: "Administrator",
                  description: "General Administrator",
                  active: "true"        
                 };

$.ajax({
    url: geminiUrl,
    type: "PUT",
    data: geminiData,
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function (data) {
        alert('Success!');
    }
});

Delete

This method deletes a Group

DELETE/api/groups/{groupid}

The URL must contain the Group Id.

Microsoft.NET example:

serviceManager.Groups.DeleteProjectGroup(12);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/12";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Add User to a Group

This method adds a user to a specifc group for a specific porject

POST/api/groups/{id}/join/{userId}/{projectId}

The URL must contain the Group Id, User Id and Project Id.

Microsoft.NET example:

serviceManager.Groups.JoinProjectGroup(12, 192, 18);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/12/join/192/18";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "POST",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Add User to a Group

This method adds a user to a specifc group for a all porjects

POST/api/groups/{id}/join/{userId}

The URL must contain the Group Id and User Id.

Microsoft.NET example:

serviceManager.Groups.JoinProjectGroup(12, 192);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/12/join/192";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "POST",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Remove User from a Group

This method removes a user from a specifc group and specific project

DELETE/api/groups/{id}/join/{userId}/{projectId}

The URL must contain the Group Id, User Id and Project Id.

Microsoft.NET example:

serviceManager.Groups.LeaveProjectGroup(12, 192, 18);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/12/leave/192/18";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});

Remove User from a Group

This method removes a user from a specifc group for all projects

DELETE/api/groups/{id}/join/{userId}

The URL must contain the Group Id and User Id.

Microsoft.NET example:

serviceManager.Groups.LeaveProjectGroup(12, 192);

JavaScript example:

var geminiUrl = "http://localhost/gemini/api/groups/12/leave/192";
var geminiUsername = Base64.encode("manager:xvitjc5bmm"); // user : apikey

$.ajax({
    url: geminiUrl,
    type: "DELETE",
    headers: { "Authorization": "Basic " + geminiUsername },
    success: function () {
        alert('Success!');
    }
});